Download a JDBC driver for MySQL (for example, the Connector/J driver). If the file that you downloaded is in an archive format (for example,.zip,.tar.gz, and so on), extract its contents. Copy the.jar file from the extracted contents to a location on your hard disk drive. MySql JDBC Driver. This article will explain what are JDBC drivers, how to download the MySql JDBC driver and how to connect to MySql using DbSchema Free Database Designer. What are JDBC Drivers? JDBC drivers are Java library files with the extension.jar used by all Java applications to connect to the database.
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 File → Manage 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.
JDBC drivers should not be stored in the ext
directory.
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.
SQL Workbench/J is not using the system's |
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:etcTheDriverjdbcDriver.jar;c:etcTheDriver'
).
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.
Mysql Jdbc Driver Download
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 no longer available in Java 8 and therefor it is not possible to connect through an ODBC data source when using SQL Workbench/J.
Mysql Jdbc Driver Class Name
This section describes some of the more important changes to the Connector/J API going from version 5.1 to 8.0. You might need to adjust your API calls accordingly:
Mysql Jdbc Driver Dependency
The name of the class that implements
java.sql.Driver
in MySQL Connector/J has changed fromcom.mysql.jdbc.Driver
tocom.mysql.cj.jdbc.Driver
. The old class name has been deprecated.The names of these commonly-used classes and interfaces have also been changed:
ExceptionInterceptor: from
com.mysql.jdbc.ExceptionInterceptor
tocom.mysql.cj.exceptions.ExceptionInterceptor
StatementInterceptor: from
com.mysql.jdbc.StatementInterceptorV2
tocom.mysql.cj.interceptors.QueryInterceptor
ConnectionLifecycleInterceptor: from
com.mysql.jdbc.ConnectionLifecycleInterceptor
tocom.mysql.cj.jdbc.interceptors.ConnectionLifecycleInterceptor
AuthenticationPlugin: from
com.mysql.jdbc.AuthenticationPlugin
tocom.mysql.cj.protocol.AuthenticationPlugin
BalanceStrategy: from
com.mysql.jdbc.BalanceStrategy
tocom.mysql.cj.jdbc.ha.BalanceStrategy
MysqlDataSource: from
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
tocom.mysql.cj.jdbc.MysqlDataSource
MysqlDataSourceFactory: from
com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory
tocom.mysql.cj.jdbc.MysqlDataSourceFactory
MysqlConnectionPoolDataSource: from
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
tocom.mysql.cj.jdbc.MysqlConnectionPoolDataSource
MysqlXADataSource: from
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
tocom.mysql.cj.jdbc.MysqlXADataSource
MysqlXid: from
com.mysql.jdbc.jdbc2.optional.MysqlXid
tocom.mysql.cj.jdbc.MysqlXid