可以直接联吧!下在个驱动去吧,不用jdbc—odbc桥,你可以在tools中enterprise setup中添加个驱动
再把驱动添加进去就好了
/********这是连接本机的*/
import java.sql.*;
try{
Class.forName(
"com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection c = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=smsdb","sa","a");
Statement s = c.createStatement();
r=s.executeQuery(str1);
}
catch(Exception e) {
System.out.println("======================================");
System.out.println("connect has error"+e) ;}