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 1 |
Microsoft SQL Server | Yes | Natively |
com.mysql.cj.jdbc.Driver 1 |
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 1 |
Oracle OCI 8, Oracle OCI 9+, Oracle Thin | No | Natively |
org.apache.derby.jdbc.ClientDriver 1 |
Derby Remote | No | Emulated |
org.apache.derby.jdbc.EmbeddedDriver 1 |
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 1 |
MySQL (mm.MySQL Driver) | No | Emulated |
org.h2.Driver |
h2 | No | Natively |
org.hsql.jdbcDriver 1 |
Hypersonic SQL (v1.3 and later) | No | Emulated |
org.hsqldb.jdbc.JDBCDriver 1 |
Hypersonic SQL (v2.0+ Remote), Hypersonic SQL (v2.0+ File) | Yes | Natively |
org.postgresql.Driver 1 |
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.
Installing a new driver
To install database drivers that are not included out-of-the-box:
- Obtain a copy of the driver JAR file.
- Put the JAR in the
<martini-home>/lib/ext/
directory. - Restart Martini.
After doing this, you should see the driver amongst the list of available database drivers when adding a new database connection.
The image above shows the H2 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 |
|
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 |
|
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 |
|
Around line 61:
1 2 |
|