最好能把详细的cfg.xml文件贴出来,谢谢:)
------解决方案--------------------
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String dbURL = "jdbc:sqlserver://172.20.121.165; DatabaseName=adv_jmdata ";
String userName = " ";
String userPwd = " ";
Connection dbConn;
try {
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
Statement stmt=dbConn.createStatement();
ResultSet rs=stmt.executeQuery( "select ctr_id,name10 from adv_jmdata.dbo.mgtctr ");
String name;
String port;
while(rs.next())
{
name=rs.getString( "name10 ");
port=rs.getString( "ctr_id ");
System.out.println(port);
System.out.println(name);
}
System.out.println( "Connection Successful! ");
} catch (Exception e) {
e.printStackTrace();
}
------解决方案--------------------
有驱动干嘛不用呀!
有些时候,不要自己给自己找麻烦!