Child pages
  • Multi-DataSource pooling with JDBC-Provider

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


This package uses the configuration PID org.clazzes.jdbc.provider and may be configured with keys using the following patternpatterns:

datasource.<datasourcename>.urlJDBC URL
datasource.<datasourcename>.userJDBC User
datasource.<datasourcename>.passwordJDBC Password
datasource.<datasourcename>.validationQueryValidation query, executed to ensure the application receives a valid connectiondatasource.<datasourcename>.maxActiveOptional

For more supported key patterns take a look at the JavaDoc of the org.clazzes.util.jdbc.provider.JdbcProvider class.

Typical JDBC URLs and validation queries can be found in our JDBC Snippets.

Configuration example

Sample configuration file /etc/apache-karaf/org.clazzes.jdbc.provider.cfg:


No Format
datasource.JPTEST.url = jdbc:mysql://localhost/JPTEST
datasource.JPTEST.username = jptest
datasource.JPTEST.password = jptest321
datasource.JPTEST.validationQuery = SELECT 1
datasource.SPECTRUM.url = jdbc:oracle:thin:@
datasource.SPECTRUM.maxActive = 8
datasource.SPECTRUM.username = FOO
datasource.SPECTRUM.password = bar
datasource.SPECTRUM.validationQuery = select SYSDATE from DUAL


Developer Snippets

pom.xml Snippets

It's important for the maven-bundle-plugin to import the Package javax.sql: