Cheers Gav
SUPPOSEDLY you update your %CLASSPATH% variable to reference the path to the
.jar file and reboot. I have rebooted my computer like 25 times today.
The jdbc:odbc bridge works fine "out of the box" by referencing a DSN, but I
keep getting a classNotFound exception with the mySQL jdbc driver. I am also
asking for someone with experience to help out. I haven't heard from anyone
with the answer yet.
Anyway, the code you use looks something like this (in JSP):
---
<%@ page import = "java.sql.*,
java.util.*,
java.awt.*"
errorPage = "error.jsp" %>
<%
Connection conn = null;
Statement stmt = null;
String getSQL = null;
String address = null;
getSQL = "SELECT customerAddress " +
"FROM thetable " +
"WHERE thecolumn = 'theCriteria';";
Class.forName("org.gjt.mm.mysql.Driver");
conn = DriverManager.getConnection("jdbc:mysql://databasename","uid","pass");
stmt = conn.createStatement();
rs = stmt.executeQuery(getSQL);
if (rs.next()) {
// do something with the resultset
address = rs.getString("customerAddress");
}
// ... etc
if (rs!=null) rs.close();
if (stmt!=null) stmt.close();
if (conn!=null) conn.close();
%>
Here is the address: <%=address%>
--------
Like I said, it's all theory, because I haven't gotten it to work because of
this lame driver problem. :( I get this over and over and over and over...
-------------------------
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
_0002fentryform_0002ejspentryform_jsp_136._jspService(_0002fentryform_0002ejspe
ntryform_jsp_136.java:96)
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(ContextManager.java:797)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Aj
p12ConnectionHandler.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)
~)ason
Cheers Gav
"Jason" <ja...@toTheLeft.net> wrote in message
news:9l9ufk$er5$1...@bob.news.rcn.net...
> I have not been able to get this damn driver to work either.
>
> SUPPOSEDLY you update your %CLASSPATH% variable to reference the path to
> the
> .jar file and reboot. I have rebooted my computer like 25 times today.
The wonders of Windows...
If you make an application, you can starti it by doing e.g.
java -classpath c:\path\to\mysql.jar.
It however seems that you use JSP and Tomcat...
Place the mm driver in the lib directory under your webapp, e.g
c:\tomcat\webapps\mywebapp\WEB-INF\lib\
--
Nils O. Selåsdal