This is documentation for Mathematica 5.2, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

JDBC Configuration

Any file that is in a DatabaseResources directory with an extension of .m will be inspected to see if it contains possible JDBC configuration information. Here is the format of a JDBC configuration file:

JDBCDriver[
    "Name" -> "name",
    "Driver" -> "driverclass",
    "Protocol" -> "protocol",
    "Version" -> 1
]

where name is the name of the connection (as might be used in OpenSQLConnection), driverclass is the class file of the JDBC driver, and protocol is the JDBC protocol. The version of the configuration file is specified by the Version setting.

Here is an example file (configured for HSQLDB):

JDBCDriver[
    "Name" -> "hsqldb",
    "Driver" -> "org.hsqldb.jdbcDriver",
    "Protocol" -> "jdbc:hsqldb:",
    "Version" -> 1
]

This file specifies the driver and protocol to use when OpenSQLConnection is invoked for an hsqldb connection, such as the following command.

OpenSQLConnection[JDBC["hsqldb",ToFileName[{"DatabaseLink","Examples"},"example"]]

Here is another example file (configured for Oracle):

JDBCDriver[
    "Name" -> "oracle",
    "Driver" -> "oracle.jdbc.driver.OracleDriver",
    "Protocol" -> "jdbc:oracle:thin:@",
    "Version" -> 1
]

This specifies the driver and protocol to use when OpenSQLConnection is invoked for an oracle connection, such as the following command.

OpenSQLConnection[JDBC["oracle","server.business.com:1999"],
    Username -> "server1"]

Note that if you added an application to hold JDBC driver classes, as shown in the previous section, you could create a DatabaseResources directory in the same application to hold JDBC configuration information. The following table shows the layout of an application, named Oracle, that could be used for connecting to the Oracle database.

When you have installed a new JDBC driver, you might want to go to the JDBC Connection section to confirm that your new driver is accessible to the system.