Connector/J
Hi All
I have installed MySql connector Version 5.1 and i have placed the jar file in CATALINA_HOME/lib. I wrote the following code in a jsp file, and when running it i got ClassNotFoundException:
<%
Class.forName("com.mysql.jdbc.Driver");
String url ="jdbc:mysql://localhost:3306/exam";
Connection con = DriverManager.getConnection(url,"root","exam");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select type from questions");
while( rs.next() ){
System.out.println( rs.getString("type") );
}
}catch( Exception e ){
}
%>
Any help please?
[1012 byte] By [
jotnartaa] at [2007-11-27 11:49:07]

# 1
[CATALINA_HOME]/lib?No such directory exists.
Do you mean [CATALINA_HOME]/common/lib or [CATALINA_HOME]/shared//lib?
Of [WEB_APP]/WEB-INF/lib?
The most appropriate place would be /common/lib
What is the name of the file you have deployed there? Something like mysql-connector-java-3.1.8-bin.jar
Open it with winzip - does it contain class files?
Try restarting your Tomcat Server.
Also, you should NOT just be ignoring the exceptions in your block.
At the least, print out the message and stack tract so that it can be debugged. I don't see any "try" statement in this code you have provided, so I'm not sure where your current exception is coming from.