Different versions of MySQL Connector/J are available:
Connector/J 5.1 is a Type 4 pure Java JDBC driver, which
conforms to the JDBC 3.0, 4.0, 4.1, and 4.2 specifications. It
provides compatibility with all the functionality of MySQL,
including 4.1, 5.0, 5.1, 5.5, 5.6, and 5.7. Connector/J 5.1
provides ease of development features, including
auto-registration with the Driver Manager, standardized
validity checks, categorized SQLExceptions, support for large
update counts, support for local and offset date-time variants
from the java.time
package, support for
JDBC-4.x XML processing, support for per connection client
information, and support for the
NCHAR
,
NVARCHAR
and
NCLOB
data types. This release also
includes all bug fixes up to and including Connector/J 5.0.6.
Connector/J 5.0 provides support for all the functionality offered by Connector/J 3.1 and includes distributed transaction (XA) support.
Connector/J 3.1 was designed for connectivity to MySQL 4.1 and MySQL 5.0 servers and provides support for all the functionality in MySQL 5.0 except distributed transaction (XA) support.
Connector/J 3.0 provides core functionality and was designed for connectivity to MySQL 3.x or MySQL 4.1 servers, although it provides basic compatibility with later versions of MySQL. Connector/J 3.0 does not support server-side prepared statements, and does not support any of the features in versions of MySQL later than 4.1.
The following table summarizes the Connector/J versions available, along with the details of JDBC driver type, what version of the JDBC API it supports, what versions of MySQL Server it works with, and whether it is currently supported or not:
Table 2.1 Summary of Connector/J Versions
Connector/J version | Driver Type | JDBC version | MySQL Server version | Status |
---|---|---|---|---|
5.1 | 4 | 3.0, 4.0, 4.1, 4.2 | 4.1, 5.0, 5.1, 5.5, 5.6, 5.7 | Recommended version |
5.0 | 4 | 3.0 | 4.1, 5.0 | Released version |
3.1 | 4 | 3.0 | 4.1, 5.0 | Obsolete |
3.0 | 4 | 3.0 | 3.x, 4.1 | Obsolete |
The current recommended version for Connector/J is 5.1. This guide also covers earlier versions of Connector/J, with specific notes given where a setting applies to a specific option.
For details of new features and bug fixes in each Connector/J release, see the MySQL Connector/J 5.1 Release Notes.
The following table summarizes what version of JRE is required to use Connector/J with Java applications, and what version of JDK is required to build Connector/J source code:
Table 2.2 Summary of Java Versions Required by Connector/J 5.1 and Earlier
Connector/J version | JRE Supported | JDK required (to build source code) |
---|---|---|
5.1 | 1.5.x, 1.6.x, 1.7.x*, 1.8.x** | 1.6.x and 1.5.x |
5.0 | 1.3.x, 1.4.x, 1.5.x, 1.6.x | 1.4.2, 1.5.x, 1.6.x |
3.1 | 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x | 1.4.2, 1.5.x, 1.6.x |
3.0 | 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x | 1.4.2, 1.5.x, 1.6.x |
*JRE 1.7 support requires Connector/J 5.1.21 and higher.
**JRE 1.8 is required for Connector/J 5.1 to connect to MySQL 5.6.27 and later and 5.7 with SSL/TLS when using some cipher suites.
If you are building Connector/J from source code using the source distribution (see Section 3.4, “Installing from Source”), you must use JDK 1.4.2 or newer to compile the package for Connector/J 5.0 or earlier. For Connector/J 5.1, you must have both JDK-1.6.x AND JDK-1.5.x installed to be able to build the source code.
Several JDBC 4.1 methods were implemented for the first time in Connector/J 5.1.21.
Because of the implementation of
java.sql.Savepoint
, Connector/J 3.1.0 and
newer will not run on a Java runtime older than 1.4 unless the
class verifier is turned off (by setting the
-Xverify:none
option to the Java runtime). This
is because the class verifier will try to load the class
definition for java.sql.Savepoint
even
though it is not accessed by the driver unless you actually use
savepoint functionality.
Caching functionality provided by Connector/J 3.1.0 or newer is
also not available on JVMs older than 1.4.x, as it relies on
java.util.LinkedHashMap
, which was first
available in JDK-1.4.0.
MySQL Connector/J does not support JDK-1.1.x or JDK-1.0.x.