Posted In: Server, Tomcat

Tomcat 9 – How to correct java.sql.SQLException: No suitable driver found

Case 1 – Using Tomcat connection pool

Developer is using

<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource">

to create JNDI. Then please verify TOMCAT/lib has JDBC drivers available.
Oracle – ojdbc6.jar
MySQL – mysql-connector-java-6.0.5.jar
HSQLDB – hsqldb-1.8.0.7.jar
PostgreSQL – PostgreSQL JDBC 4.1 Driver, 42.1.4.jre7

Case 2 – Using JDBC driver manager to create connection

Either put driver jar in WEB-INF/lib of your application or put jat in TOMCAT/lib
Oracle – ojdbc6.jar
MySQL – mysql-connector-java-6.0.5.jar
HSQLDB – hsqldb-1.8.0.7.jar
PostgreSQL – PostgreSQL JDBC 4.1 Driver, 42.1.4.jre7

Is it must the JDBC driver be put in TOMCAT_HOME/lib folder?

Yes if developer is using Tomcat connection pool to create data source.

by , on August 26th, 2017

  • Categories