The lib folder in the Tomcat installation directory contains all jar files that should be loaded automatically on startup.

Copy the jar of the database driver to the lib folder and restart the server.

You need to install the appropriate database driver first. See database drivers for more details on how to get the drivers. This page illustrates how to install the database driver for Tomcat, using MySQL as an example. The procedure is similar for other database management systems. 

Only one driver may be installed per database management system, even if some (e.g. Microsoft SQL Server) offer several suitable drivers.

The database driver is a jar file named, for example, apache-tomcat/lib/mysql-connector-java-5.1.46.jar. This file needs to be copied to the lib directory of your Tomcat installation. All jar files in that directory are picked up by Tomcat automatically.

The Tomcat installation directory looks as follows:

  • apache-tomcat
    • bin
    • conf
    • lib
    • logs
    • webapps
    • ...

You need to copy the database driver to the library directory, so that the file apache-tomcat/lib/mysql-connector-java-5.1.46.jar exists. Restart the server and the driver is available and can be selected.

Tags:
Copyright 2000-2024