tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Headley <shead...@swbell.net>
Subject newbie question: Setting up MySql JDBC with Tomcat 4.0
Date Mon, 22 Oct 2001 19:54:08 GMT
Hi all,
    I am having problems setting up MySql with Tomcat 4.0 on linux.
Tomcat is working fine. I downloaded and placed mm.mysql-2.0.4-bin.jar
in CATALINA_HOME/lib. I then copied the following jsp from a website:

%@ page import="java.sql.*" %>
<%
String connectionURL =
"jdbc:mysql://localhost/database?user=username;password=****";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>
 
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM src_cd");
 
while (rs.next()) {
out.println(rs.getString("SrcCd_Desc")+"");
}
 
 
rs.close();
%>                 
 
I stopped and restarted tomcat and pointed the browser to the jsp page,
the following is what I got:

I get the following error message:

         A Servlet Exception Has Occurred

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occured between lines: 2 and 7 in the jsp file: /test.jsp

Generated servlet error:
/usr/local/jakarta/jakarta-tomcat-4.0-b7/work/localhost/struts-logon/_0002ftest_jsp.java:60:
Class org.apache.jsp.Connection not found.
                Connection connection = null;
                ^


An error occured between lines: 2 and 7 in the jsp file: /test.jsp

Generated servlet error:
/usr/local/jakarta/jakarta-tomcat-4.0-b7/work/localhost/struts-logon/_0002ftest_jsp.java:61:
Class org.apache.jsp.Statement not found.
                Statement statement = null;
                ^


An error occured between lines: 2 and 7 in the jsp file: /test.jsp

Generated servlet error:
/usr/local/jakarta/jakarta-tomcat-4.0-b7/work/localhost/struts-logon/_0002ftest_jsp.java:62:
Class org.apache.jsp.ResultSet not found.
                ResultSet rs = null;
                ^


An error occured between lines: 9 and 21 in the jsp file: /test.jsp

Generated servlet error:
/usr/local/jakarta/jakarta-tomcat-4.0-b7/work/localhost/struts-logon/_0002ftest_jsp.java:71:
Undefined variable or class name: DriverManager
                connection = DriverManager.getConnection(connectionURL,
"", "");
                             ^


An error occured between lines: 9 and 21 in the jsp file: /test.jsp

Generated servlet error:
/usr/local/jakarta/jakarta-tomcat-4.0-b7/work/localhost/struts-logon/_0002ftest_jsp.java:80:
Variable rs may not have been initialized.
                rs.close();
                ^
5 errors                                                    

could someone please tell me what I did wrong?


    Thanks in advance.

    Steven H.

Mime
View raw message