关于网友提出的“ 我也是连接access 数据库出问题,运行错误提示是"no suitable driver",请大家看看,明天就要交了,急!在线等!”问题疑问,本网通过在网上对“ 我也是连接access 数据库出问题,运行错误提示是"no suitable driver",请大家看看,明天就要交了,急!在线等!”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 我也是连接access 数据库出问题,运行错误提示是"no suitable driver",请大家看看,明天就要交了,急!在线等!
描述: 我的程序代码:opendb.java:
package opendb;
import java.sql.*;
public class opendb {
String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String sConnStr = "jdbc:odbc:JSP";
Connection conn = null;
ResultSet rs = null;
public opendb() {
try {
Class.forName("sDBDriver");
}
catch (java.lang.ClassNotFoundException e) {
System.err.println("opendb():" + e.getMessage());
}
}
public ResultSet executeQuery(String sql) {
rs = null;
try {
conn = DriverManager.getConnection(sConnStr, "Julianne", "237726");
Statement stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
}
catch (SQLException ex) {
System.err.println("sqlException" + ex.getMessage());
}
return rs;
}
}
以上介绍了“ 我也是连接access 数据库出问题,运行错误提示是"no suitable driver",请大家看看,明天就要交了,急!在线等!”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2374222.html