Marcin Orliński
Marcin Orliński

Reputation: 13

How to configure Data Source in Data Service on WSO2 Micro Integrator?

I have WSO2 Data Service working on WSO2 Micro Integrator - Data Service configured inside Data Service configuration file. Now I would like to make external configuration of Data Source to change Working Environment (DEV/TST/UAT/PROD). How can I achiev this?

Version WSO2: 6.5.0

I have changed configuration RDBMS to Carbon Data Source and I have tried configure Data Source on:

but in each case I have:

DS Fault Message: Error in creating Carbon data source: null
DS Code: UNKNOWN_ERROR
Source Data Service:-

java.lang.NullPointerException
    at org.wso2.carbon.dataservices.core.description.config.ConfigFactory.getCarbonDataSourceConfig(ConfigFactory.java:184)

In Data Service configuration file:

  <config id="ONEDB">
    <property name="carbon_datasource_name">ONEDS</property>
  </config>

and example of datasources.properties:

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

synapse.datasources.ONEDS.registry=JNDI
synapse.datasources.ONEDS.type=BasicDataSource
synapse.datasources.ONEDS.driverClassName=oracle.jdbc.driver.OracleDriver
synapse.datasources.ONEDS.url=jdbc:oracle:thin:@olddb1.myhost.pl:2033:ONEDEV
synapse.datasources.ONEDS.username=cust_user
synapse.datasources.ONEDS.password=cust_pass
synapse.datasources.ONEDS.dsName=ONEDS
synapse.datasources.ONEDS.maxActive=100
synapse.datasources.ONEDS.maxIdle=20
synapse.datasources.ONEDS.maxWait=10000

I have the same if I change:

synapse.datasources.ONEDS.registry=Memory

DS defined in Data Service configuration file works fine (but it is hardcode configuration):

  <config id="ONEDB">
    <property name="org.wso2.ws.dataservice.user">cust_user</property>
    <property name="org.wso2.ws.dataservice.password">cust_pass</property>
    <property name="org.wso2.ws.dataservice.protocol">jdbc:oracle:thin:@olddb1.myhost.pl:2033:ONEDEV</property>
    <property name="org.wso2.ws.dataservice.driver">oracle.jdbc.driver.OracleDriver</property>
  </config>

I expect separate configuration Data Source from definition Data Service.

Maybe there is some way to parameterize RDBMS Data Source?

Upvotes: 0

Views: 1422

Answers (2)

Marcin Orliński
Marcin Orliński

Reputation: 13

In WSO MI 1.1.0 data source works fine.

  1. Data source definition is in /repository/resources/conf/default.json - to add:
    "datasource": [
        {
          "id": "ONEDS",
          "url": "jdbc:oracle:thin:@oracle.db.host.name:1234:DBNAME",
          "username": "USER",
          "password": "PASSWORD",
          "driver": "oracle.jdbc.driver.OracleDriver"
        }
      ]
  1. At the start WSO2, configuration is generated to /conf/master-datasources.xml

Upvotes: 1

Sajinie Kavindya
Sajinie Kavindya

Reputation: 26

Currently in WSO2 MI (v1.0.0), data sources work only if you define them inline in the data service itself as you have mentioned above since the carbon data sources feature has not been shipped with this release.

You may find the public git issue here. They will provide the support for this feature in a future release.

Upvotes: 1

Related Questions