Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Problem in connecting MySql with Servlets

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ,
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ,

 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic