Tomcat - No suitable driver found for jdbc:avatica:remote:url=

Hi,

I am developing a web app in Eclipse, using Maven and Jetty. The application uses JDBC to Druid and it works without any problems in Jetty. If I try to run the application in Tomcat (internal in Eclipse or external) I get the following error

java.sql.SQLException: No suitable driver found for jdbc:avatica:remote:url=http://localhost:18082/druid/v2/sql/avatica/

at java.sql.DriverManager.getConnection(DriverManager.java:689)

at java.sql.DriverManager.getConnection(DriverManager.java:208)

at DruidDao.getConnection(DruidDao.java:939)

``

My pom.xml has the following dependencies for the jdbc driver

org.apache.calcite.avatica

avatica

1.10.0

org.apache.calcite.avatica

avatica-server

1.10.0

``

I have copied all jars in the WEB-INF/lib of my app as well ad in the lib dir of Tomcat, but I always get the same error. If I add the following code

try {

Class.forName(“org.apache.calcite.jdbc.Driver”);

} catch (ClassNotFoundException e1) {

e1.printStackTrace();

}

``

I get a no class found exception (only in tomcat)… why this inconsistent behaviour? How to fix errors in Tomcat?

Thank you in advance for any help.

Cheers

Hi

I have figured it out, the correct driver to instantiate is

try {

Class.forName(“org.apache.calcite.avatica.remote.Driver”);

} catch (ClassNotFoundException e1) {

e1.printStackTrace();

}

``

Now it works. It would be useful to add it to the documentation.

Cheers!