Apache Derby Driver Adapter
Usage
The Pax JDBC Apache Derby Driver Adapter registers a DataSourceFactory
in the OSGi service registry, adapting implementation classes from the Derby Embedded Driver, which is an OSGi bundle and does not need to be wrapped.
The DataSourceFactory
methods of this adapter produces objects with the following implementation classes:
- EmbeddedDriver
- EmbeddedDataSource40
- EmbeddedConnectionPoolDataSource40
- EmbeddedXADataSource
Service Properties
The Derby Driver Adapter registers its DataSourceFactory
with the following service properties:
osgi.jdbc.driver.class
=org.apache.derby.jdbc.EmbeddedDriver
osgi.jdbc.driver.name
=derby
Method Arguments
The argument passed to createDataSource(), createConnectionPoolDataSource(), createXADataSource()
supports the following properties:
DataSourceFactory.JDBC_DATABASE_NAME
(mandatory)DataSourceFactory.JDBC_USER
DataSourceFactory.JDBC_PASSWORD
An SQLException
is thrown if a mandatory property is missing. Other properties than the ones listed above will be passed directly to the underlying JDBC driver.
createDriver()
This method returns an instance of EmbeddedDriver
. 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
osgi.jdbc.driver.class
=org.apache.derby.jdbc.EmbeddedDriver
osgi.jdbc.driver.name
=derby
Required Maven Artifacts
- org.ops4j.pax.jdbc:pax-jdbc-derby
- org.apache.derby:derby
- org.osgi:org.osgi.enterprise:4.2.0
- An OSGi 4.2 framework