写的jdbc连接代码出现了这个异常: 
Exception in thread "main" java.sql.SQLException: No suitable driver 
附代码如下:- import java.sql.*; 
 
 - public class qtdm { 
 
 - public static void main(String[] args) 
 
 - throws SQLException, ClassNotFoundException { 
 
 - //定义了数据库连接串 
 
 - String dbUrl = "jdbc:microsoft:sqlserver://HL-20121119WABA\\CDMAMIRROR:1433;DatabaseName=xueshengchengjiguanlixitong"; 
 
 - //数据库的用户名 
 
 - String user = "sa"; 
 
 - //数据库的用户口令 
 
 - String password = "123QWEasd"; 
 
 - // 加载jdbc-odbc bridge驱动程序 
 
 - Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
 
 - // 与url指定的数据源建立连接 
 
 - Connection conn = DriverManager.getConnection(dbUrl, user, password); 
 
 - //采用Statement进行查询 
 
 - Statement state = conn.createStatement(); 
 
 - System.out.println("sucessful" ); 
 
 - state.close();conn.close();
 
 - } 
 
 - // 关闭Statement,其上的ResultSet也将关闭 
 
 - }
 
 
  复制代码 |