Generic Driver Extender


The Pax JDBC Generic Driver Extender registers a DataSourceFactory in the OSGi service registry on behalf of any OSGi-compatible JDBC driver with a META-INF/services/java.sql.Driver resource. This resource is mandatory for any JDBC 4.0 driver.

This DataSourceFactory implementation only supports the following methods:

DataSource createDataSource( Properties props ) throws SQLException;
Driver createDriver( Properties props ) throws SQLException;

The methods createConnectionPoolDataSource() and createXADataSource() always throw an SQLException.

Service Properties

The Generic Driver Extender registers each DataSourceFactory with the following service properties:

  • osgi.jdbc.driver.class = fully qualified class name of extended driver


The argument passed to createDataSource() supports the following properties:

  • DataSourceFactory.JDBC_URL (mandatory)
  • DataSourceFactory.JDBC_USER
  • DataSourceFactory.JDBC_PASSWORD

All other properties are ignored.


This method returns an instance of the driver class listed in the META-INF/services/java.sql.Driver resource of the extended driver. 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
  • osgi.jdbc.driver.class = fully qualified class name of extended driver

Required Maven Artifacts

  • org.ops4j.pax.jdbc:pax-jdbc
  • an OSGi-ready JDBC driver (use the Pax URL wrap: Protocol to osgify a driver on the fly)
  • org.osgi:org.osgi.enterprise:4.2.0
  • An OSGi 4.2 framework