6. JDBC Drivers

6.1. Configuring JDBC drivers
6.2. Specifying a library directory
6.3. Popular JDBC drivers

6.1. Configuring JDBC drivers

Before you can connect to a DBMS you have to configure the JDBC driver to be used. The driver configuration is available in the connection dialog or through FileManage Drivers

The JDBC driver is a file with the extension .jar (some drivers need more than one file). See the end of this section for a list of download locations. Once you have downloaded the driver you can store the driver's .jar file anywhere you like.

To register a driver with SQL Workbench/J you need to specify the following details:

  • the driver's class name
  • the library ("JAR file") where to find the driver (class)

After you have selected the .jar file(s) for a driver (by clicking on the button), SQL Workbench/J will scan the jar file looking for a JDBC driver. If only a single driver is found, the class name is automatically put into the entry field for the class name. If more than one JDBC driver implementation is found, you will be prompted to select one. In that case, please refer to the manual of your driver or database to choose the correct one.

[Note]

SQL Workbench/J is not using the system's CLASSPATH definition (i.e. the environment variable named CLASSPATH) to load the driver classes. Changing the CLASSPATH environment variable to include your driver's library will have no effect.

If you enter the class name of the driver manually, remember that it's case-sensitive: org.postgresql.driver is something different than org.postgresql.Driver

Files that are not found are displayed in red and italics.

The name of the library has to contain the full path to the driver's jar file, so that SQL Workbench/J can find it. Some drivers are distributed in several jar files. In that case, select all necessary files in the file open dialog, or add them one after the other. If an entry is selected in the list of defined jar files when adding a new jar file, the selected entry will be overwritten.

For drivers that require a license file, you have to include the license jar to the list of files for that driver.

If the driver requires files that are not contained in the jar library, you have to include the directory containing those files as part of the library definition (e.g: "c:\etc\TheDriver\jdbcDriver.jar;c:\etc\TheDriver").

You can assign a sample URL to each driver, which will be put into the URL property of the profile, when the driver class is selected.

SQL Workbench/J comes with some sample URLs pre-configured. Some of these sample URLs use brackets to indicate a parameters that need to be replaced with the actual value for your connection: (servername) In this case the entire sequence including the brackets need to be replaced with the actual value.

[Important]

The JDBC/ODBC bridge is no longer available in Java 8 and therefor it is not possible to connect through an ODBC data source when using SQL Workbench/J.

6.2. Specifying a library directory

When defining the location of the driver's .jar file, you can use the placeholder %LibDir% instead of the using the directory's name directly. This way your WbDrivers.xml is portable across installations. To specify the library directory, either set it in the workbench.settings file, or specify the directory using the -libdir switch when starting the application.

6.3. Popular JDBC drivers

Here is an overview of common JDBC drivers, and the class name that need to be used. SQL Workbench/J contains predefined JDBC drivers with sample URLs for connecting to the database.

Most drivers accept additional configuration parameters either in the URL or through the extended properties. Please consult the manual of your driver for more detailed information on these additional parameters.

DBMSDriver classLibrary name
PostgreSQLorg.postgresql.Driver
postgresql-9.4-1203.jdbc4.jar (exact name depends on PostgreSQL version)
http://jdbc.postgresql.org
Firebird SQLorg.firebirdsql.jdbc.FBDriver
firebirdsql-full.jar
http://www.firebirdsql.org/
Oracleoracle.jdbc.OracleDriver
ojdbc7.jar
http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
H2 Database Engineorg.h2.Driver
h2.jar
http://www.h2database.com
HSQLDBorg.hsqldb.jdbcDriver
hsqldb.jar
http://hsqldb.sourceforge.net
IBM DB2com.ibm.db2.jcc.DB2Driver
db2jcc4.jar
http://www-01.ibm.com/software/data/db2/linux-unix-windows/download.html
IBM DB2 for iSeriescom.ibm.as400.access.AS400JDBCDriver
jt400.jar
http://jt400.sourceforge.net/
Apache Derbyorg.apache.derby.jdbc.EmbeddedDriver
derby.jar
http://db.apache.org/derby/
Teradatacom.teradata.jdbc.TeraDriver
terajdbc4.jar
http://www.teradata.com/DownloadCenter/Forum158-1.aspx
Sybase SQL Anywherecom.sybase.jdbc3.jdbc.SybDriver
jconnect.jar
http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect
SQL Server (Microsoft driver)com.microsoft.sqlserver.jdbc.SQLServerDriver
sqljdbc42.jar
http://msdn.microsoft.com/data/jdbc
SQL Server (jTDS driver)net.sourceforge.jtds.jdbc.Driver
jtds.jar
http://jtds.sourceforge.net
MariaDBorg.mariadb.jdbc.Driver
mariadb-java-client-1.3.6.jar (exact name depends on the driver version)
https://downloads.mariadb.org/connector-java/
MySQLcom.mysql.jdbc.Driver
mysql-connector-java-5.1.36-bin.jar (exact name depends on the driver version)
http://www.mysql.com/downloads/connector/j/