[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-developers] problem with mm.mysql jdbc driver
- Subject: Re: [cobalt-developers] problem with mm.mysql jdbc driver
- From: "Paul Adamson" <paul@xxxxxxxxxxxxx>
- Date: Mon Apr 29 06:35:01 2002
- List-id: Discussion Forum for developers on Sun Cobalt Networks products <cobalt-developers.list.cobalt.com>
As your using jsp and not just using a normal java class, the directory you
want to put it in is
/home/sites/www.domain.tld/web/WEB-INF/classes/org/gjt/mm/mysql/
(is that all you say :)
This will let tomcat find the mysql classes, the code you supplied should
work for the quick scan i gave it, or at least get you past this hurdle!
you *might* hit some java permission problems opening tcp ports to the
database server, thats easilly fixed, if you run across that, send me a
mail.
hope that gets you going,
Paul Adamson
Technical Developer
Friction Studios
----- Original Message -----
From: "Diana Saunders" <toodi4@xxxxxxxxxxx>
To: <cobalt-developers@xxxxxxxxxxxxxxx>
Sent: Monday, April 29, 2002 3:48 AM
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?user=member&pass
word=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(_0002fjdbctest_0002ejspjdb
ctest_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.ja
va:130)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va: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(ContextManager.java:81
2)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> at
>
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:166)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.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
>