[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-developers] problem with mm.mysql jdbc driver



To change the classpath long-term you can edit it in your TOMCAT-HOME/bin/tomcat.sh file. I'm pretty sure this is a bad thing and having done it that way on my server makes me a bad person, but it works fine.

If you are running with a security manager you will have to make sure your mysql driver has the correct permissions to talk to the database as well.

-ben

> -----Original Message-----
> From: Diana Saunders [mailto:toodi4@xxxxxxxxxxx]
> Sent: 29 April 2002 03:49
> To: cobalt-developers@xxxxxxxxxxxxxxx
> Subject: [cobalt-developers] problem with mm.mysql jdbc driver
> 
> 
> I have jdk installed on my RAQ3.
> 
> I have read on this list about the mm.mysql driver.  I 
> downloaded the jar 
> file, placed it in the /usr/jakarta-tomcat/lib directory.  I 
> then restarted 
> tomcat. (I have also restarted httpd on subsequent attempts)  
> As a jar file, 
> I thought this would be enough.  I did not receive any error 
> messages upon 
> restarting, and the jar file showed up in the start-up 
> message.  However, I 
> get error messages when trying to use jdbc.  I have read in 
> some posts that 
> you need to add the jar file to the classpath.  I did this 
> using the export 
> command, yet still have the same problem.  (even if it did 
> work, I don't 
> know how to make the classpath change permanent since the 
> changes drop off 
> when you log off.)
> 
> I have copied below both the jsp page source, and the main 
> part of the error 
> message when viewing it.  I hope someone can help.  I know 
> others have had 
> similar problems, but I can't find much in the way of a solution.
> 
> -------
> jsp script
> ---------
> 
> <html>
> <head>
> </head>
> <%@ page language="java" import="java.sql.*" %>
> <body>
> <%
>   Class.forName("org.gjt.mm.mysql.Driver");
> 
> 
> // change this as per your requirements
>   Connection myConn =
> DriverManager.getConnection("jdbc:mysql://localhost/members?us
er=member&password=testpassword");
> 
>   Statement stmt = myConn.createStatement();
> 
> 
>   String query = "select * from members";
> 
>   ResultSet myResultSet = stmt.executeQuery(query);
> 
>   if (myResultSet != null) {
>     while (myResultSet.next()) {
>       // specify the field name
>       String name = myResultSet.getString("name");
> 
> %>
> <%= name %>
> <br>
> <%
>     }
>   }
> 
>   stmt.close();
> 
>   myConn.close();
> %>
> </body>
> </html>
> 
> ------------
> error message in browser
> ------------
> 
> Root cause:
> 
> java.lang.ClassNotFoundException: Unable to load class 
> org.gjt.mm.mysql.Driver
>         at 
> org.apache.jasper.servlet.JasperLoader.findClass(JasperLoader.
> java:223)
>         at 
> org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.
> java:147)
>         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 
> _0002fjdbctest_0002ejspjdbctest_jsp_0._jspService(_0002fjdbcte
> st_0002ejspjdbctest_jsp_0.java:64)
>         at 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at 
> org.apache.jasper.servlet.JspServlet$JspCountedServlet.service
> (JspServlet.java:130)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at 
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
> (JspServlet.java:282)
>         at 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:429)
>         at 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at 
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> .java:405)
>         at org.apache.tomcat.core.Handler.service(Handler.java:287)
>         at 
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at 
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:812)
>         at 
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
>         at 
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> cessConnection(Ajp12ConnectionHandler.java:166)
>         at 
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> t.java:416)
>         at 
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> ol.java:501)
>         at java.lang.Thread.run(Thread.java:484)
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp.

_______________________________________________
cobalt-developers mailing list
cobalt-developers@xxxxxxxxxxxxxxx
http://list.cobalt.com/mailman/listinfo/cobalt-developers