我厌倦了没有结果的搜索,我不知道问题出在哪里,我正在尝试将我的 android 应用程序与本地 SQl 服务器 2008 连接,现在我无法从 sql 服务器获取信息。请帮助这是我的代码:
String url = "jdbc:jtds:sqlserver://10.0.2.2:1433/lear_db;instance=SQLEXPRESS;";
TextView coucou = new TextView(this);
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
java.sql.Connection connexion =
DriverManager.getConnection(url,"kamal","kamal1234");
coucou.setText("Connection successful");
} catch ( SQLException e) {
// TODO Auto-generated catch block
coucou.setText("error1" + e.getMessage());
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
coucou.setText("error2" + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
coucou.setText("error0" + e.getMessage());
e.printStackTrace();
}
setContentView(coucou);