java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: yilinglim
Date: July 29, 2004 12:36AM

hi there,

i'm failed to connect the MySQL driver, anyone can help me?
i don't know where comes wrong !

following are the script that i type in .jsp ----------->

<%@page contentType="text/html"%>
<%@page import="java.sql.*"%>
<%@page import="javax.servlet.http.*"%>
<%@page import="java.lang.*"%>
<%@page buffer='none'%>

<html>
<head><title>Early Warning System</title></head>
<body>

<%

Connection conn = null;
Statement stm = null;
ResultSet rst=null;

try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://buah:3306/epal","mangga","123456");
stm = conn.createStatement();
out.println("success<br>");
} catch (Exception exc) {
exc.printStackTrace();
out.println(exc.toString());
out.println("failed<br>");
}

String sql = "select distinct Year from sunny";

rst = stm.executeQuery(sql);

while(rst.next()) {
out.print(rst.getString("Year"));
}

%>
Hello..
<%
rst.close();
stm.close();
conn.close();
%>
</body>
</html>
----------------------------------------------------------------------------------------------------------
anything wrong about my script ?? for the Class.forName, i tried
Class.forName("com.mysql.jdbc.Driver").newInstance();
too.... but also cant work..
everytime i run the code, it will display
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver and failed!!

Any help will be appreciated.



Options: ReplyQuote


Subject
Written By
Posted
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
July 29, 2004 12:36AM
April 07, 2007 11:27PM
December 26, 2007 11:43AM
February 05, 2008 01:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.