DB2 driver adapter
Usage
The Pax JDBC DB2 Driver Adapter registers a DataSourceFactory
in the OSGi service registry, adapting implementation classes from an osgified DB2 JDBC Driver.
The DB2 drivers are not available in maven central. You need to load them from IBM by hand and upload them to you maven repository
Besides that the driver is a plain old JAR without OSGi manifest headers. You will have to wrap this on the fly using the Pax URL wrap:
handler, or build your own bundle, adding an OSGi manifest.
Service Properties
The Driver Adapter registers its DataSourceFactory
with the following service properties:
osgi.jdbc.driver.class = com.ibm.db2.jcc.DB2Driver
osgi.jdbc.driver.name
=db2
Method Arguments
The argument passed to createDataSource(), createConnectionPoolDataSource(), createXADataSource()
supports the following properties:
DataSourceFactory.JDBC_DATABASE_NAME
(mandatory)DataSourceFactory.JDBC_USER
- DataSourceFactory.JDBC_PASSWORD
Other properties are forwarded as they are to the native DB2 DataSources so that you can set any native driver option.
createDriver()
This method returns an instance of oracle.jdbc.OracleDriver. Any properties passed to this method are ignored.
Obtaining a DataSourceFactory
To obtain a DataSourceFactory
, use any OSGi service lookup or injection method (Declarative Services, Blueprint) of your choice and specify the following properties:
objectClass
=org.osgi.service.jdbc.DataSourceFactory
and at least one of the service properties above.
Required Maven Artifacts
- org.ops4j.pax.jdbc:pax-jdbc-spec
- org.ops4j.pax.jdbc:pax-jdbc-db2
- An OSGi-ready wrapped version of ojdbc
- An OSGi 4.2 framework
Available since
Pax JDBC 0.9.0.