MariaDB Driver Adapter

Usage

The Pax JDBC MariaDB Driver Adapter registers a DataSourceFactory in the OSGi service registry, adapting implementation classes of the mariadb-java-client JDBC Driver.

The DataSourceFactory methods of this adapter produces objects with the following implementation classes:

  • org.mariadb.jdbc.Driver
  • org.mariadb.jdbc.MysqlDataSource

Service Properties

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

  • osgi.jdbc.driver.class = org.mariadb.jdbc.Driver
  • osgi.jdbc.driver.name = mariadb

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 any other properties are set or if a mandatory property is missing.

createDriver()

This method returns an instance of org.mariadb.jdbc.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

and at least one of

  • osgi.jdbc.driver.class = org.mariadb.jdbc.Driver
  • osgi.jdbc.driver.name = mariadb

Required Maven Artifacts

  • org.ops4j.pax.jdbc:pax-jdbc-mariadb
  • org.jumpmind.symmetric.jdbc:mariadb-java-client
  • org.osgi:org.osgi.enterprise:4.2.0
  • An OSGi 4.2 framework