Forum Discussion

FICO's avatar
FICO
Community Manager
14 years ago

Custom Provider to dynamically populate the fields of a database provider

Custom Provider to dynamically populate the fields of a database provider

Hi,

Need to develop a custom provider, which will read the contents from a property file and will update the drivername, dbURl, username and password of a database provider dynamically so that when we open the rule maintenance application, we will be able to fetch respective databases.

Using the example, i tried to create a custom provider, which can be statically overwritten as DriverName or dbUrl and fetch the respective data but i am not able to fetch the value from java layer to the blaze end.

The sysouts given in the java file suggests that the value is rightly picked but am not able to fetch the value in the value holder of the template i created. 

When i am trying to display the value in the display part of the template, though there are hard coded part that should be displayed any way in the instance., nothing is being displayed.

This is very urgently needed and am not able to find any clue.

Please suggest. Need it very urgently.

4 Replies

  • FICO's avatar
    FICO
    Community Manager

    Hi,

         From what it sounds like you are trying to do I have used a slightly different approach.  My assumption is that you are trying to "externalize" the DB definitions so that as the project gets promoted, the correct version of the database will be used (DEV, PROD, etc).  When I needed to accomplish this, I used Java system variables.  I'm talking about the ones that are specified on the command line when Java starts an application and are specified as -Dname=value.  These can be coded into the startup script of the RMA and create a separate version for each enviroment or, the value part can be an environment variable that is set in the enviroment via a separate script before starting the RMA.

         Now to use them, create a DB Provider in your template and use system variable provider in a dynamic override to pass in the values of the system variable.

         Hope this helps,

         Tom Sheckells

         Business Rules Consulting, Inc.

  • FICO's avatar
    FICO
    Community Manager

    you could also set your data source up in JNDI and have your providers pull the datasource from there that you want your querys to run against.

    If you're using websphere I think you would do this in the environment.xml

  • FICO's avatar
    FICO
    Community Manager

    The JNDI option doesn't work because the DB provider has to work in the IDE as well and the IDE does not run in an App Server environment.

    Tom Sheckells

    Business Rules Consulting, Inc.

  • FICO's avatar
    FICO
    Community Manager

    I'll just say that it does work, as this is how it's currently setup at the shop I am at. We pull the database connection information from jndi for our providers even within the IDE.