Go to window and select Samples Console from open perspective. Then click on import projects in Data sources for BOM Domains to import the project as shown in the below fig.
Now the bomdomainpopulate project is imported into our Rule Designer. This project uses a plugin project with the name ilog.rules.studio.samples.bomdomainpopulate to fetch the domain values from DB. This plugin project works with Derby DB. To work with Derby DB, we can refer the following link here
If we want to use a database other than derby, then we need to do some changes in the plugin project, so that it can work with the preferred DB. To do the changes in the plugin project, we need to follow these steps
Go to File and select import. Select Plugins and Fragments from the import window as shown and click on next.
Select Project with source folders and click on next.
Select ilog.rules.studio.samples.bomdomainpopulate and click on add.
Click on Finish.
We have imported is an existing plugin project. Now we will do the following changes in this project, to make it work with other DB. Click on the plugin project and select properties. Click on Java Build Path and remove derbyclient.jar and click on ok.
Now remove the derbyclient.jar from lib folder.
Now add the required DB driver jar file in the lib folder as shown. For eg., let us make this plugin to fetch domains from Oracle DB. So add ojdbc6.jar file in the lib folder.
Then Select the plugin project and click on properties. Click on java Build Path and add the ojdbc6.jar file, which is present in the lib folder of the plugin project.
Then click on data and select database.properties. This properties file has the properties w.r.t., derby DB.
Change the properties w.r.t. the preferred DB. For eg., the following figure shows the connection properties with reference to the Oracle DB.
After that, select the MANIFEST.MF file and click on runtime tab as shown. Remove the Derby references.
After removing the derby references, add the DB references which we wanted to use. Here we take it as oracle references.
Now click on build tab as shown in the fig and select the lib folder in which the ojdbc6.jar is present.
Now click on MANIFEST.MF tab and remove the “lib/derbyclient.jar” and add “lib/ojdbc6.jar”.
Now go the default plugin folder in your PC. The default plugin folder will be in the path: <INSTALL_DIR>/IBM/IMShared/plugins. Here the number 8.8.0.0 in the folder name refers to the ODM version we are using. Take the backup of the folder shown below. This is the same plugin project which we have worked in eclipse. But the changes done by us are done at the workspace level. To reflect the changes in the plugin level, copy the plugin project from eclipse IDE and paste in this default plugin location.
Now go the preferred DB console and enter the following commands. Click Here.
Now the changes are completed. Restart the eclipse IDE, so that the changes made in the plugin will be reflected in the eclipse IDE. After restarting the eclipse IDE, select the bomdomainpopulate-rules project and click on CurrencyType. If there are any domain values in the domains section, select “Edit the domain” option.
Select all the domains and click on remove. Click Finish.
Then select all the members and click on delete.
Click on save and then click on synchronize with dynamic values.
Now we will be able to see the domain values which are fetched from the preferred DB i.e., Oracle.
If we add or delete any domain values in the DB, click on synchronize with dynamic values to reflect the changes.
Hello Kiran
ReplyDeleteI really Apreciate your post it has been so useful for me.
At this moment i am using this example for a Sybase Database, i need refresh the domains for a new class called "TipoDocumental", in the database already exist this table, but i can not refresh the dynamic domains, i do click under refresh button but nothing happens.
How can i prove the connection to the database? or what can i do?
thanks for your answer!
Hi Kiran,
ReplyDeleteThanks for providing the step by step process to get domain values from the database. i am doing the same process by using mysql and almost got completed.But I am getting an error "The value provider is invalid. Check the custom properties". while doing synchronize the domain values. Can you please help me.
Thank You,
Mastan