No suitable driver found Mariadb

Asked

Viewed 105 times

-3

I am trying to insert a tuple of data into a DB using JDBC through a web page.

I took a class ConnectionFactory to encapsulate the connection with Mariadb, I imported the driver to the classpath, tested by entering some data with a class Teste with a Main and it worked, recognized the driver as normal. However, when I use Servlet it shows the error:

inserir a descrição da imagem aqui

I already put the driver jar inside the Tomcat lib folder, I already put inside the WEB-INF/lib on the project deploy but nothing. I’ve also put:

Class.forName("com.mysql.jdbc.Driver");    

in Factory but unsuccessfully.

  • 1

    mariadb uses the same driver as Mysql? Also, the port is right? This port is the default for Mysql.

  • Check the port that mariadb is running and the name of the table that is trying to enter the data, since the error says that there is no such information.

  • So I made one. jar to run per command line using the connection and it worked, I entered several data... it is only when I deploy in Tomcat that it works bad, even using the same driver. Somehow Tomcat is not recognizing the driver, even though it is in the project lib and Tomcat itself

1 answer

1


It is no longer necessary to specify the Class.forName since the Java SE 6. However, if you wish to declare, in specification of Mariadb says the right class: org.mariadb.jdbc.Driver.

  • Valeu @brunoandrade.io, de veras had put with.mysql.jdbc.Driver qd tested i Class.forName for conscience awakening. To deploy to Tomcat you must specify the force qd to create the connection...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.