Oracle driver adapter

Usage

The Pax JDBC Oracle Driver Adapter registers a DataSourceFactory in the OSGi service registry, adapting implementation classes from an osgified ojdbc JDBC Driver.

The ojdbc drivers are not available in maven central. You need to load them from oracle 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. This gap is to be filled by the Pax Tipi project.

Service Properties

The Driver Adapter registers its DataSourceFactory with the following service properties:

Method Arguments

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

  • DataSourceFactory.JDBC_DATABASE_NAME (mandatory)
  • DataSourceFactory.JDBC_USER
  • DataSourceFactory.JDBC_SERVER_NAME
  • DataSourceFactory.JDBC_PORT_NUMBER
  • DataSourceFactory.JDBC_PASSWORD

An SQLException is thrown if any other properties are set or if a mandatory property is missing.

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-oracle
  • An OSGi-ready wrapped version of ojdbc
  • An OSGi 4.2 framework