Mysql Jdbc Driver

Details
Written by Nam Ha Minh
Last Updated on 13 March 2020 | Print Email

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. Specify to the DriverManager which JDBC drivers to try to make Connections with. The easiest way to do this is to use Class.forName on the class that implements the java.sql.Driver interface. With MySQL Connector/J, the name of this class is com.mysql.cj.jdbc.Driver. With this method, you could use an external configuration file to supply the.

This post lists resources to download JDBC drivers for common databases, for your reference in database programming with Java.You know, in order for Java applications working with a database engine via Java Database Connectivity (JDBC)Mysql, an appropriate JDBC driver library is required to be available in the application’s classpath. A JDBC driver library consists of Java classes which implement low-level communication with the database engine. It talks with Java applications via JDBC API and usually bundled as a JAR or ZIP file.For your reference and convenience, this article provides a summary of JDBC driver download for common databases including MySQL, SQL Server, Oracle, PostgreSQL, Apache Derby (Java DB), SQLite and Microsoft Access. If you use Maven, see the Maven dependencies for those JDBC drivers below.In the table below, click on the download link corresponding to the database you want to download its JDBC driver JAR file:

JDBC Driver Download:

Database

JDBC Driver Provider

JAR file name

Download

MySQL

Oracle Corporation

mysql-connector-java-VERSION.jar

SQL Server

Microsoft Corporation

sqljdbc41.jar, sqljdbc42.jar

Oracle

Oracle Corporation

ojdbc6.jar, ojdbc7.jar, ojdbc8.jar

The PostgreSQL Global Development Group

postgresql-VERSION.jar

Apache Derby

Apache Software Foundation

derby.jar, derbyclient.jar

SQLite

Xerial.org

sqlite-jdbc-VERSION.jar

Microsoft Access

UCanAccess.com

ucanaccess-VERSION.jar

NOTES:

Mysql Jdbc Driver Url

  • Some drivers come as JAR files (Oracle, PostgreSQL), so you can add the JAR files directly to your application’s classpath.
  • Some drivers come as zipped bundles (MySQL, SQL Server), so you have to extract the bundles and copy the appropriate JAR file (as specified in the above table) to your application’s classpath.
  • There is a distribution of Apache Derby comes with JDK 7 called Java DB. So if you are using JDK 7, you can use the jar files directly from JDK_HOMEdblib directory without downloading Apache Derby. However, Java DB is removed from JDK since Java 8.

Maven Dependencies for JDBC Drivers

If your Java project uses Maven, simply add the following dependency in the pom.xmlfile.

Maven Dependency for MySQL JDBC Driver:

Maven Dependency for Microsoft JDBC driver for SQL Server:


Maven Dependency for Oracle JDBC Driver:

NOTE: Due to Oracle's license restriction, you must manually download Oracle JDBC driver and use system dependency like that.

Maven Dependency for PostgreSQL JDBC Driver:

Maven Dependency for SQLite JDBC Driver:

Maven Dependency for Apache Derby JDBC Driver:

Maven Dependency for Microsoft Access JDBC Driver:

Mysql jdbc driver nameNOTE: The versions of the dependencies listed above may not be up to date. You can search on Maven Central Repository for the latest versions.

Mysql Jdbc Driver Java

Related JDBC Tutorials:

Mysql Jdbc Driver

About the Author:

Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.