尝试使用以下代码建立 sql 连接:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionString = "jdbc:sqlserver://192.168.0.155;user=user;password=****";
Connection conn= DriverManager.getConnection(connectionString);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select xx from TBL_Test where ID = 1");
String aa = rs.getString("xx");
txtgir.setText(aa);
问题是我一直得到 classnotfound 异常,并且驱动程序被添加到构建路径中...... :( 问候。