当前位置: 技术问答>java相关
为什么用JDBC、ODBC桥连接数据库时,总是说“No suitable driver"呢???
来源: 互联网 发布时间:2015-02-14
本文导语: 部分代码如下: try{ String vurl = "jdbc:odbc:mdbjdbc"; java.sql.Connection vconnection; java.sql.Statement vstatement; java.sql.ResultSet result; String sql; vconnection = java.sql.DriverManager.getConnection(vurl,"teacher","teacher"); vstatemen...
部分代码如下:
try{
String vurl = "jdbc:odbc:mdbjdbc";
java.sql.Connection vconnection;
java.sql.Statement vstatement;
java.sql.ResultSet result;
String sql;
vconnection = java.sql.DriverManager.getConnection(vurl,"teacher","teacher");
vstatement = vconnection.createStatement();
sql = "SELECT comment_id,email,name,comment,date FROM comments"+getWhere();
result = vstatement.executeQuery(sql);
谢谢大家!!!!!!!!
try{
String vurl = "jdbc:odbc:mdbjdbc";
java.sql.Connection vconnection;
java.sql.Statement vstatement;
java.sql.ResultSet result;
String sql;
vconnection = java.sql.DriverManager.getConnection(vurl,"teacher","teacher");
vstatement = vconnection.createStatement();
sql = "SELECT comment_id,email,name,comment,date FROM comments"+getWhere();
result = vstatement.executeQuery(sql);
谢谢大家!!!!!!!!
|
你没有加载驱动程序。
用
Class.forName(String) 或
DriverManager.registerDriver(Driver driver)
加在你想要的驱动程序
如:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
用
Class.forName(String) 或
DriverManager.registerDriver(Driver driver)
加在你想要的驱动程序
如:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
|
在你的CLASSPATH中加入相应的驱动程序的JAVA类。
如:针对ORACLE加入CLASSES12.ZIP
如:针对ORACLE加入CLASSES12.ZIP