File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in connecting MySql with Servlets

 
Thamu Gurung
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thankyou for helping me in Swing and IO. Now i got strucked in Servlets , i did proper matching and all , but could not establish the connetion between MYSql and Servlets. I visited to other threads but could not get the solution.

- The version of Mysql installed is 5.1.43-comunity
- The driver which i have used is mysql-connector-java-5.1.12

The codes which i am using is



The errror msg displayed is as follows :-
exception

javax.servlet.ServletException: Servlet Could not display records.
DBConnection.service(DBConnection.java:42)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

java.sql.SQLException: No suitable driver found for jdbc:mysql://192.168.10.59:3306/thamu
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
DBConnection.service(DBConnection.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Hoping to have help ,as new in Java.

Regards ,
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put the driver jar into the application/server classpath. if you sue tomcat then typically at tomcat/lib(in tomcat6.X) and tomcat/common/lib(in tomcat5.X)
 
Thamu Gurung
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mr. Seetharaman,

I did but its still not working , I just copied the source code from net and tried to get the connection. The code which i am using is follows:-



and thes servlet mapping is done like in this in the XML file ...



I copied the jar file in the tomcat6/lib , but still getting the same error when trying to get the page http://localhost:8080/tryconnect/DBConnection.do

please suggest if you could please help me out with this . Will be thankful to you.

Regards ,

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to copy the required jar into your project lib folder. The problem's cause might be of unmatched driver. Please check that too.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jdbc:mysql://192.168.10.59:3306/thamu"


probably your url is wrong for the appropriate sql-coonnector jar
 
Thamu Gurung
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,

Thankyou for your replies ,, i figured it out and now its working ....

I have to copy that jar file in to jdk/jre , which i did not . but its done now and working well.

Thanks.

I have posted new thread please help me in that .

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic