| Author |
How to add mm.mysql jdbc driver to tomcat 4?
|
Andrew Parker
Ranch Hand
Joined: Nov 12, 2001
Posts: 178
|
|
Hi, I installed tomcat 4.0.4 full version on my redhat 7.3. I configured it properly and it showed the default page of http://localhost:8080. I want to install the mm.mysql jdbc driver. However, I cannot find out where is the Tomcat4 installed? When I whereis tomcat4, it showed: /etc/tomcat4 /usr/bin/tomcat4 They are not the folder to include the lib directory for me to put the mm.mysql jdbc driver. Where is the tomcat4/lib? How can I find it? Thanks Andrew
|
 |
Andrew Parker
Ranch Hand
Joined: Nov 12, 2001
Posts: 178
|
|
Hi, I found the tomcat4/lib which is located under /var. I have the same setting on win2k and the following program runs fine, i.e. jsp can connect to mysql. However, when I used the same file and database, it did not work under linux box. Why and how should I fix it? Here is the program: <html> <head><title>Employee List</title></head> <body> <%@ page import="java.sql.*" %> <table border=1 width="70%"> <tr><th>Last name</th><th>First name</th></tr> <% Connection conn = null; Statement st = null; ResultSet rs = null; try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); conn=DriverManager.getConnection("jdbc:mysql://localhost/employees"); st = conn.createStatement(); rs = st.executeQuery("select * from employees"); while(rs.next()) { %> <tr><td><%= rs.getString("lname_txt") %></td> <td><%= rs.getString("fname_txt") %></td></tr> <% } %> </table> <% } catch (Exception ex) { ex.printStackTrace(); %> </table> Ooops, somthing bad happened: <% } finally { if (rs != null) rs.close(); if (st != null) st.close(); if (conn != null) conn.close(); } %> </body> </html> ** employees is the name of the database.
|
 |
Andrew Parker
Ranch Hand
Joined: Nov 12, 2001
Posts: 178
|
|
Sorry, the way that I installed the mm.mysql is correct. What's wrong is the conn in the jsp file: conn=DriverManager.getConnection("jdbc:mysql://localhost/employees", "user", "pwd"); Thanks for help Andrew
|
 |
 |
|
|
subject: How to add mm.mysql jdbc driver to tomcat 4?
|
|
|