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 →
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:
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 classname is automatically put into the entry field for the classname. 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.![]() | |
If you enter the class name of the driver manually, remember that it's case-sensitive:
|
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"
).
![]() | |
SQL Workbench/J is not using
the system CLASSPATH definition (i.e. environment variable) to load the
driver classes. Changing the CLASSPATH environment variable to include
your driver's library will not work. Using the |
You do not need to specify a library for the JDBC-ODBC bridge, as the necessary drivers are already part of the Java runtime.
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.
![]() | |
The JDBC/ODBC bridge is very unreliable, slow and considered a workaround. It also no longer available in Java 8. A real JDBC driver should always be preferred over using the JDBC/ODBC bridge. |
To connect to a database using an ODBC driver, you must first setup an ODBC datasource with the tools of your operating system (e.g. the control panel in Windows®)
Once you have set up the ODBC datasource, select the ODBC Bridge as the driver
in the connection dialog. The JDBC URL for the datasource connection then is
jdbc:odbc:name_of_your_datasource
.
If you named your ODBC datasource ProductDB
, then the JDBC url for SQL Workbench/J would be
jdbc:odbc:ProductDB
The ODBC driver's architecture must match the architecture of the Java version you are using. If you are using a 64bit Java runtime, the ODBC drivers must be 64bit as well. If you are using a 32bit Java runtime, the ODBC driver must be 32bit as well.
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.
Here is an overview of common JDBC drivers, and the classname 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.
DBMS | Driver class | Library name | ||
---|---|---|---|---|
PostgreSQL | org.postgresql.Driver |
| ||
Firebird SQL | org.firebirdsql.jdbc.FBDriver |
| ||
Oracle | oracle.jdbc.OracleDriver |
| ||
H2 Database Engine | org.h2.Driver |
| ||
HSQLDB | org.hsqldb.jdbcDriver |
| ||
IBM DB2 | com.ibm.db2.jcc.DB2Driver |
| ||
IBM DB2 for iSeries | com.ibm.as400.access.AS400JDBCDriver |
| ||
Apache Derby | org.apache.derby.jdbc.EmbeddedDriver |
| ||
Teradata | com.teradata.jdbc.TeraDriver |
| ||
Sybase SQL Anywhere | com.sybase.jdbc3.jdbc.SybDriver |
| ||
MySQL | com.mysql.jdbc.Driver |
| ||
SQL Server (Microsoft driver) | com.microsoft.sqlserver.jdbc.SQLServerDriver |
| ||
SQL Server (jTDS driver) | net.sourceforge.jtds.jdbc.Driver |
|