• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Help MYSQL /JDBC/Servlets

 
kripa ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Am comparatively new to servlets and MYsql. Am using Tomcat app server on Win 98. I wrote a servlet that is supposed to connect to a Mysql database and display the records. But the servlet displays the headings given out as html tables..and then it comes out with errors as given below..The driver am using is mm.mysql.driver..
I tried setting the class path
c:\jdk1.3\lib\mmsql.jar.. it didnt work..am getting puzzled as to where the jar file should be put now.. how do i extract the driver's class file from the jar.
*****
Headings
CategoryProduct NameProduct Rate
Error: 500
Location: /examples/servlet/imshoppe.ProductsInternal Servlet Error:javax.servlet.ServletException: JDBC Driver not found.
at imshoppe.Products.doPost(Products.java:81)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.java:524)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at imshoppe.Products.doPost(Products.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You appear to be using Tomcat 3.2.x, so it's odd that setting the jar file in your CLASSPATH didn't work.(how did you compile your servlet?)

In any case, do not unjar this file, and place it here:
<tomcat-home>/lib

For Tomcat 4.0.x, use <catalina-home>/common/lib
 
Sreenivasa Majji
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case, I would recommend to write some sample Java application to make sure that it actually connects to the database and fetches some data from mysql. Later put the drivers files in tomcat library and restart the server. I am using Resin JSP engine and simply I added the .jar file in the lib directory and it's working like a charm. I will try this JSP-JDBC connection with Tomcat.

------------------
Sreenivasa Kumar Majji
Sun Certified Java Programmer
SCJP Mock Test
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!