0
votes

I am using WSO2 ESB 4.0.3. I have installed WSO2 Data Services Feature on it and I have created DS.

There is feature in the ESB under "Configure" tab under admin UI where you can define the "Data Source".

My question is while creating new Data Service I am not able to use this "Data Source" which I have configured in ESB. We have different environments DEV / TEST / UAT / PROD. Each environment has different data base for same data service.

Currently I have manually change the DS XML file to point to new DB and then deploy.

Is there a way to point to the DB configured in ESB and change the DB for DS on the fly?

thanks ABhijit

07/01/2012 - Any update on this please ? This is Apple POC in their big group. If suceedded WSO2 will have Apple implementation?

2

2 Answers

0
votes

If you've installed the dataservices features in to the same ESB instance that you've already been using, then it should be possible for you to use the datasources created via "Configure > Data Sources" menu. Because, when you create a particular datasource via the aforesaid option, it is visible to all the other installed features (that use datasources). But if you're having ESB and DSS in two boxes, the datasources defined in let's say ESB are not visible the DSS node unless you're having those nodes mounted to the same registry. However, this functionality too will be there in the next immediate upcoming release.

However, I'd suggest you the following pattern to get your requirement done. I;m assuming you're having DataServices features installed into ESBs in all your environments DEV / TEST / UAT / PROD. If so, you can create datasources using the "same name" (for eg: assume you have a datasource named "ds1" created in all 4 environments) via the "Configure > DataSources" menu pointing to different database configurations that you'll be using in each of those environments. Then you can point to the created datasource inside the DBS (dataservice discripters) as shown below.

<data name="TestDataService">
   <config id="default">
      <property name="carbon_datasource_name">ds1</property>
   </config>
   .....
</data>

Once you're done with those steps, whenever you deploy your dataservice in any of your environments, it will point to the relevant datasource without requiring you to reconfigure the database configurations manually and the relevant database configurations specific to each environment will be loaded dynamically at the runtime.

Hope the above explanation helps!

Regards, Prabath

0
votes
#----- Start of the configuration -----

synapse.datasources=TestDS,TestDS1

synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
synapse.datasources.providerPort=2199

#TestDS Configuration
synapse.datasources.TestDS.registry=JNDI
synapse.datasources.TestDS.type=BasicDataSource
synapse.datasources.TestDS.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS.url=jdbc:mysql://localhost:3306/testDB
synapse.datasources.TestDS.username=dummy_username
synapse.datasources.TestDS.password=dummy_password
synapse.datasources.TestDS.dsName=TestDS
synapse.datasources.TestDS.maxActive=100
synapse.datasources.TestDS.maxIdle=20
synapse.datasources.TestDS.maxWait=10000

#TestDS1 configuration
synapse.datasources.TestDS1.registry=JNDI
synapse.datasources.TestDS1.type=BasicDataSource
synapse.datasources.TestDS1.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS1.url=jdbc:mysql://localhost:3306/testDB1
synapse.datasources.TestDS1.username=dummy_username
synapse.datasources.TestDS1.password=dummy_password
synapse.datasources.TestDS1.dsName=TestDS1
synapse.datasources.TestDS1.maxActive=100
synapse.datasources.TestDS1.maxIdle=20
synapse.datasources.TestDS1.maxWait=10000

#----- End of the configuration -----