帮忙搞定链接sql数据库问题
java在链接sql数据库的时候提示
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
是什么原因啊 ,是我的 classpath中需要加入什么吗??
哥们实在是没思路了 。
代码如下:::
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn= DriverManager.getConnection ("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Data_cheng","wei","wei");
Statement stmt = conn.createStatement();
System.out.println("**************************");
ResultSet rsss= stmt.executeQuery("select * from 对应");
while(rsss.next()){
System.out.print(rsss.getString("权限")+"\t");
System.out.print(rsss.getString(2)+"\t");
//System.out.println(rsss.getString(3));
}
}catch(java.lang.ClassNotFoundException err){System.err.println(err.toString());}
catch(SQLException err){System.err.println(err.toString());}