我厭倦了搜索沒有結果我不知道問題來自哪裏,我試圖連接我的android應用程序與本地SQl服務器2008年,現在我得到無法從sql server獲取信息。請幫助,這是我的代碼:使用jtds連接android應用程序到sql server
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);
查看我的[回覆](http://stackoverflow.com/a/15273775/2024761)以查看'JAR'是否存在。如果它仍然存在,那麼跟蹤粘貼錯誤堆棧。 – SudoRahul 2013-03-07 16:51:58