Z
zhao0707
Unregistered / Unconfirmed
GUEST, unregistred user!
下载了mm.mysql的1.0和1.2版本,设置了classpath=d:/mm.mysql.jdbc-1.0/;或者设置为
classpath=d:/mm.mysql.jdbc-1.2b/;,mysql版本为3.23.43,
错误信息:Unable to load driver. SQLException:
No suitable driver SQLState: 08001 VendorError: 0
程序:(附:以下代码通过jdbc-odbc连接成功)
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%
try {
Class.forName("org.git.mm.mysql.Driver");
}
catch (Exception E) {
out.println("Unable to load driver.");
}
try {
Connection C = DriverManager.getConnection("jdbc:mysql://localhost/lz?user=root");
Statement s=C.createStatement();
ResultSet rs=s.executeQuery("select P_number from aa01");
while(rs.next())
{out.println(rs.getString("P_number")); }
rs.close();
s.close();
C.close();
}
catch (SQLException E) {
out.println("SQLException: " + E.getMessage());
out.println("SQLState: " + E.getSQLState());
out.println("VendorError: " + E.getErrorCode());
}
%>
classpath=d:/mm.mysql.jdbc-1.2b/;,mysql版本为3.23.43,
错误信息:Unable to load driver. SQLException:
No suitable driver SQLState: 08001 VendorError: 0
程序:(附:以下代码通过jdbc-odbc连接成功)
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%
try {
Class.forName("org.git.mm.mysql.Driver");
}
catch (Exception E) {
out.println("Unable to load driver.");
}
try {
Connection C = DriverManager.getConnection("jdbc:mysql://localhost/lz?user=root");
Statement s=C.createStatement();
ResultSet rs=s.executeQuery("select P_number from aa01");
while(rs.next())
{out.println(rs.getString("P_number")); }
rs.close();
s.close();
C.close();
}
catch (SQLException E) {
out.println("SQLException: " + E.getMessage());
out.println("SQLState: " + E.getSQLState());
out.println("VendorError: " + E.getErrorCode());
}
%>