主题:跪求,java 连 sql server 的问题
package jdbcproject;
import java.sql.*;
class Authors{
public static void main(String args[]){
//Statement st;
Connection conn;
try{
String sDBDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
Class.forName(sDBDriver).newInstance();
String sConnStr =
"jdbc:microsoft:sqlserver://localhoat:8080;DatabaseName=pubs";
String username = "sa";
String password = "";
conn = DriverManager.getConnection(sConnStr, username,
password);
Statement stmt = conn.createStatement();
String query="select city from authors";
ResultSet rs=stmt.executeQuery("query");
while(rs.next()){
String city=rs.getString("city");
System.out.println(city);
}
stmt.close();
conn.close();
}
catch(Exception em){
System.out.println("出现的异常为: " +em);
}
}
}
出现的异常为: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver