0

I have a problem when I try to make database calls from a web application.

I'm using a javabean to make these calls. I have already tested this bean, and it is working in classical application (i mean: not a web application).

I tried to use it in a jsp pages, but it didn't work. I got an exception:

>java.sql.SQLException
No suitable driver found for jdbc:mysql://localhost:3306/db_hafic?relaxAutoCommit=true 

I read articles about how to make database calls from within tomcat environment, but I'm still quite lost.

I'm using jsp/tomcat/mysql.

1

2 Answers 2

3

First read the documentation:

Install the .jar file(s) containing the JDBC driver in Tomcat's common/lib folder. You do not need to put them in your application's WEB-INF/lib folder. When working with J2EE DataSources, the web application server manages connections for your application.

Sign up to request clarification or add additional context in comments.

Comments

0

3 common problems:

  1. Incorrect syntax Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX")

  2. Typo mistake on "com.mysql.jdbc.Driver" e.g. Class.forName("com.mysql.jdbc.Driver").newInstance();

  3. Missing mysql_jdbc Jar Include the latest mysql jdbc driver in your tomecat classpath

your situation should be the problem 3, download the driver at http://www.mysql.com/downloads/connector/j/

add the library at WEB-INF/lib/ and deploy again.

Hope it can help!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.