In WSO2 products , we can configured DataSources with lot of features. We can do it using Admin Console in those products.
But sometimes we want to do it remotely like in automated deployment
enlivenment. Then we can use a service to that provided by the Admin
Services.
Using curl command.
curl
-k -u admin:admin -d @datasourceconfig.xml -H "Content-Type:
application/xml action=addDataSource"
https://hostname:9443/services/NDataSourceAdmin
datasourceconfig.xml
<xsd:addDataSource xmlns:xsd="http://org.apache.axis2/xsd"
xmlns:xsd1="http://services.core.ndatasource.carbon.wso2.org/xsd"
xmlns:xsd2="http://core.ndatasource.carbon.wso2.org/xsd">
<xsd:dsmInfo>
<xsd1:definition>
<xsd1:dsXMLConfiguration>
<![CDATA[<configuration>
<url>jdbc:mysql://localhost:3306/dbname</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>]]>
</xsd1:dsXMLConfiguration>
<xsd1:type>RDBMS</xsd1:type>
</xsd1:definition>
<xsd1:description>description</xsd1:description>
<xsd1:jndiConfig>
<xsd2:name>... JNDI Name here ..</xsd2:name>
<xsd2:useDataSourceFactory>false</xsd2:useDataSourceFactory>
</xsd1:jndiConfig>
<xsd1:name>... DataSourceName Here ..</xsd1:name>
<xsd1:system>false</xsd1:system>
</xsd:dsmInfo>
</xsd:addDataSource>
No comments:
Post a Comment