JDBC for MySQL - Herong's Tutorial Examples
∟MySQL JDBC Driver (MySQL Connector/J)
∟MySQL Connector/J - Download and Installation
This section describes how to download and install MySQL Connector/J (JDBC driver).
With MySQL server installed and running, I am ready to try the JDBC driver to access my MySQL server.
Here is what I did to download and install MySQL JDBC driver:
- Go to the MySQL Drivers page at
https://www.mysql.com/products/connector/.
- Click Download link next to "JDBC Driver for MySQL (Connector/J)".
- Select the "Platform Independent" version.
- Click the Download link next to "Platform Independent (Architecture Independent),
ZIP Archive 8.0.27 5.0M
(mysql-connector-java-8.0.27.zip)"
- Login to Oracle or create a new account on Oracle.
- Click "Download Now" and save the download file, mysql-connector-java-8.0.27.zip,
to a temporary directory. The file size is about 5.0 MB.
- Unzip the downloaded file and get all files in the "mysql-connector-java-8.0.27"
sub-directory.
- Copy the JDBC jar file, mysql-connector-java-8.0.27.jar, to your current
working directory for easy access. And rename it as mysql-connector-java.jar
The installation is done. You should read the documentation at
https://dev.mysql.com/doc/connector-j/8.0/en/.
Some version information of MySQL Connector/J 8.0.27 is summarized here:
- MySQL Connector/J 8.0.27 implements version 4.2 of the JDBC specification.
- MySQL Connector/J 8.0.27 is a Type 4 driver - Pure Java and direct connection to the server.
- MySQL Connector/J 8.0.27 supports JDK 8 or higher environments.
Note that the MySQL JDBC driver class name has been changed from
"com.mysql.jdbc.Driver" to "com.mysql.cj.jdbc.Driver".
Table of Contents
About This Book
JDBC (Java Database Connectivity) Introduction
JDK (Java SE) Installation
MySQL Installation on Windows
►MySQL JDBC Driver (MySQL Connector/J)
►MySQL Connector/J - Download and Installation
Loading JDBC Driver for MySQL Server
JDBC Driver Connection URL
Specifying Timezone During Connection
Creating Connections with DataSource Class
Getting Driver and Server Information
Creating Tables with AUTO_INCREMENT Columns
"INSERT INTO" Statements
MySQL - PreparedStatement
MySQL - Reference Implementation of JdbcRowSet
MySQL - JBDC CallableStatement
MySQL CLOB (Character Large Object) - TEXT
MySQL BLOB (Binary Large Object) - BLOB
Using Connection Pool with JDBC
Archived Tutorials
References
Full Version in PDF/EPUB