FreeKB - Tomcat Install JDBC connector
Tomcat - Install JDBC connector

A Tomcat application server will used a JDBC JAR file to make a connection to a database. There are many different JAR files that could be used, such as:

  • mysql-connector-java-version-bin.jar
  • mariadb-java-client-1.1.3.jar


Download the JAR file

Often, the JAR file is not include when Tomcat is installed, thus you will need to download the JAR file. Here are a couple example URLs that would be used to download the JAR file.


JAR file location on Tomcat (Linux)

There are various places where the JAR file can be place, most commonly:

  • In the Tomcat "lib" directory, such as /opt/tomcat/lib
  • In an applications "WEB-INF/lib" directory, such as /opt/tomcat/profiles/applicationserver001/webapps/app001/WEB-INF/lib


JAR file setup on Linux

If the JAR file is a gzip compressed tar archive. Gunzip the tar archive.

gunzip mysql-<version>.tar.gz


Extract the tar archive.

tar -xf mysql-<version>.tar


Copy the JAR file into the directory where you want the JAR file to reside.

cp mysql-connector-java-version-bin.jar /opt/tomcat/lib/


Add the MySQL JAR to your classpath.

export CLASSPATH=/opt/jdbc/mysql-connector-java-version-bin.jar:$CLASSPATH



Extract the MySQL connector zip. Move the MySQL JAR into the appropriate directory of the application server that will be used to run your Java project. For example, if your Java project will be run using Tomcat, you would copy the MySQL JAR to the $tomcat_home/lib directory.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 9d9b6 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |