tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Msql Connector/J
Date Wed, 09 May 2007 21:15:04 GMT
Non-existent??  huh... wierd.  I could have sworn I saw a lot of it on 
the company site (www.mysql.com).

As to the OP, the classpath environment variable is ignored by tomcat's 
default startup script and for very good reason. 

Given the manner in which the jsp is attempting to get a database 
connection, WEB-INF/lib of the web application is an excellent place for 
the mysql driver jar.  I would start there.  If the OP wants to use 
tomcat's container managed database pooling, it should be moved to the 
common/lib directory of tomcat's install dir as suggested by another 
responder.

For further details, the tomcat website has information on the 
classloader hierarchy and how it works as well as details on setting up 
container managed pooling.

--David

Martin Gainty wrote:
> you and sven need to search thru the mostly nonexistent MySQL 
> documentation on how to
> start MYSQLd
> create a user (other than null@localhost)
> create DATABASE
> create TABLE in DATABASE
> turn on INNODB
>
> the MySQL documentation is pretty much nonexistent so you and sven 
> should have lots of fun
>
> M-
>
> GL
> M--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please 
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
> ----- Original Message ----- From: "Massimiliano PASQUALONI" 
> <massimiliano.pasqualoni@data-processing.it>
> To: <users@tomcat.apache.org>
> Sent: Wednesday, May 09, 2007 11:59 AM
> Subject: Msql Connector/J
>
>
>> Hi everybody!
>>
>> I'ved downloaded mysql-connector-java-5.1.0.zip.
>>
>> I'ved put the mysql-connector-java-5.1.0-bin.jar in
>> C:\Programmi\Java\jre1.6.0_01\lib and I'ved set the %CALSSPATH% on 
>> the same
>> directory.
>>
>>
>> I'ved create a jsp page:
>>
>>
>> <%@ page import="java.sql.*" %>
>> <%
>> String connectionURL =
>> "jdbc:mysql://localhost:3306/bi?user=USER;password=PASSWORD";
>> Connection connection = null;
>> Statement statement = null;
>> ResultSet rs = null;
>> %>
>> <html><body>
>> <%
>> Class.forName("com.mysql.jdbc.Driver").newInstance();
>> connection = DriverManager.getConnection(connectionURL, "", "");
>> statement = connection.createStatement();
>> rs = statement.executeQuery("SELECT * FROM  TABLE WHERE 
>> username='ciao' and
>> password='ciao' and Abilitato = 1");
>> while (rs.next()) {
>> out.println(rs.getString("username")+"<br>");
>> }
>> rs.close();
>> %>
>>
>>
>> Tomcat send me an 500 error:
>>
>>
>> type Exception report
>>
>> message
>>
>> description The server encountered an internal error () that 
>> prevented it
>> from fulfilling this request.
>>
>> exception
>>
>> org.apache.jasper.JasperException: Exception in JSP: /prova.jsp:14
>>
>>
>>
>> 11: <html><body>
>>
>> 12:
>>
>> 13: <%
>>
>> 14: Class.forName("com.mysql.jdbc.Driver").newInstance();
>>
>> 15: connection = DriverManager.getConnection(connectionURL, "", "");
>>
>> 16: statement = connection.createStatement();
>>
>> 17: rs = statement.executeQuery("SELECT * FROM ANAG_UTENTI WHERE
>> username='ciao' and password='ciao' and Abilitato = 1");
>>
>>
>>
>>
>>
>> Stacktrace:
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWra 
>>
>> pper.java:467)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 
>>
>> 71)
>>
>>
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
>>
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>>
>> root cause
>>
>> javax.servlet.ServletException: com.mysql.jdbc.Driver
>>
>>
>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI 
>>
>> mpl.java:846)
>>
>>
>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp 
>>
>> l.java:779)
>>
>> org.apache.jsp.prova_jsp._jspService(prova_jsp.java:79)
>>
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 
>>
>> 28)
>>
>>
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
>>
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>>
>> root cause
>>
>> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
>>
>>
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav 
>>
>> a:1359)
>>
>>
>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav 
>>
>> a:1205)
>>
>>
>> org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
>>
>>
>> org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
>>
>> java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>
>> java.lang.Class.forName0(Native Method)
>>
>> java.lang.Class.forName(Unknown Source)
>>
>> org.apache.jsp.prova_jsp._jspService(prova_jsp.java:57)
>>
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 
>>
>> 28)
>>
>>
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
>>
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
>>
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>
>>
>>
>> note The full stack trace of the root cause is available in the Apache
>> Tomcat/5.5.23 logs.
>>
>>
>>
>> It's the connector don't work?
>>
>>
>> Thanks!!!
>>
>>
>> Massimiliano PASQUALONI
>>
>> Data Processing S.r.l.
>> Reparto EDP
>> S.S. 100 BA-TA Km 18
>> c/o "IL BARICENTRO"
>> torre D
>> 70010 CASAMASSIMA (BA)
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


-- 
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message