Skip to content

Home

Introduction

Development

IDEs

Services

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Installing additional database drivers

Martini uses JDBC drivers to connect to databases. Aside from built-in drivers, you can install additional database drivers using their JAR files.

Driver support

The table below describes which drivers are available in Java and should be compatible with Martini:

Driver Name Built-in Driver XA Support
com.ashna.jturbo.driver.Driver Microsoft SQL Server (JTurbo Driver) No Emulated
COM.cloudscape.core.JDBCDriver Cloudscape No Natively
com.ibm.db2.jcc.DB2Driver IBM DB2 (jcc4) No Natively
com.inet.tds.TdsDriver Microsoft SQL Server (Sprinta Driver) No Emulated
com.informix.jdbc.IfxDriver Informix Dynamic Server No Natively
com.microsoft.sqlserver.jdbc.SQLServerDriver Microsoft SQL Server Yes Natively
com.mysql.cj.jdbc.Driver MySQL Yes Natively
com.pointbase.jdbc.jdbcUniversalDriver PointBase Embedded Server No Emulated
com.sybase.jdbc.SybDriver Sybase (jConnect 4.2 and earlier) No Emulated
com.sybase.jdbc2.jdbc.SybDriver Sybase (jConnect 5.2) No Emulated
hSql.hDriver Hypersonic SQL (v1.2 and earlier) No Emulated
ids.sql.IDSDriver IDS Server No Emulated
interbase.interclient.Driver Interbase No Emulated
jdbc.idbDriver InstantDB (v3.13 and earlier) No Emulated
net.sourceforge.jtds.jdbc.Driver jTDS (Sybase), jTDS (SQL Server) Yes Natively
oracle.jdbc.driver.OracleDriver Oracle OCI 8, Oracle OCI 9+, Oracle Thin No Natively
org.apache.derby.jdbc.ClientDriver Derby Remote No Emulated
org.apache.derby.jdbc.EmbeddedDriver Derby Embedded No Natively
org.enhydra.instantdb.jdbc.idbDriver InstantDB (v3.14 and later) No Natively
org.firebirdsql.jdbc.FBDriver Firebird No Natively
org.gjt.mm.mysql.Driver MySQL (mm.MySQL Driver) No Emulated
org.h2.Driver h2 No Natively
org.hsql.jdbcDriver Hypersonic SQL (v1.3 and later) No Emulated
org.hsqldb.jdbc.JDBCDriver Hypersonic SQL (v2.0+ Remote), Hypersonic SQL (v2.0+ File) Yes Natively
org.postgresql.Driver PostgreSQL (v7.0 and later) Yes Natively on PostgreSQL 8 only
postgresql.Driver PostgreSQL (v6.5 and earlier) No Emulated
RmiJdbc.RJDriver Cloudscape RMI No Emulated
sun.jdbc.odbc.JdbcOdbcDriver JDBC-ODBC Bridge No Emulated

To use XA transactions, the JDBC driver must implement XADataSource.

Check your license!

The availability of database drivers will depend on the type of license you have installed.

Procedures

To install database drivers that are not included out-of-the-box:

  1. Obtain a copy of the driver JAR file.
  2. Put the JAR under the <martini-home>/lib/ext/ directory.
  3. Restart Martini.

After doing this, you should now see the driver amongst the list of available database drivers when adding a new database connection.

List of available database drivers

List of available database drivers

The image above shows the Derby database driver installed. If your driver still doesn't appear in the list, enter the driver class name in the Driver Class field.

Caveats

Apache Derby

Apache Derby requires additional Java security permissions. Martini, by default, restricts modification of permissions at runtime. This prevents it from starting up due to the following exception:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
java.security.AccessControlException: access denied org.apache.derby.security.SystemPermission( "engine", "usederbyinternals" )
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
    at java.security.AccessController.checkPermission(AccessController.java:884)
    at org.apache.derby.iapi.security.SecurityUtil.checkDerbyInternalsPrivilege(Unknown Source)
    at org.apache.derby.iapi.services.monitor.Monitor.startMonitor(Unknown Source)
    at org.apache.derby.iapi.jdbc.JDBCBoot$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.derby.iapi.jdbc.JDBCBoot.boot(Unknown Source)
    at org.apache.derby.iapi.jdbc.JDBCBoot.boot(Unknown Source)
    at org.apache.derby.jdbc.EmbeddedDriver.boot(Unknown Source)
    at org.apache.derby.jdbc.EmbeddedDriver.<clinit>(Unknown Source)
    ...

To get around this, a custom policy file needs to be provided. Here's a minimum example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
grant codeBase "file:///path/to/integrate/lib/ext/derby.jar"
{
 //
 // These permissions are needed for everyday, embedded Derby usage.
 //
 permission java.lang.RuntimePermission "createClassLoader";
 permission java.util.PropertyPermission "derby.*", "read";
 permission java.util.PropertyPermission "user.dir", "read";
 permission java.util.PropertyPermission "derby.storage.jvmInstanceId",
     "write";
 permission org.apache.derby.security.SystemPermission "engine", "usederbyinternals";
 // The next two properties are used to determine if the VM is 32-bit
 // or 64-bit.
 permission java.util.PropertyPermission "sun.arch.data.model", "read";
 permission java.util.PropertyPermission "os.arch", "read";
};

The policy file then needs to be registered on the JVM startup options, via the -Djava.security.manager option. Assuming you saved the policy file under bin/derby.policy, modify your respective startup script accordingly:

Around line 42:

1
JAVA_OPTS="$JAVA_OPTS $JAVA_OPTS_EXT -Djava.security.policy=derby.policy

Around line 61:

1
2
%JAVA_OPTS_EXT% -classpath "%CLASSPATH%" ^
-Djava.security.policy=derby.policy ^