アプリケーションで問題が発生しています
これが私のアクティビティで例外「ErrorConnectionnet.sourceforge.jtds.jdbc.Driver」をスローするコードです。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sync = (Button) findViewById(R.id.button1);
sync.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
query2(); }
});
}
public void query2()
{
Log.i("Android"," SQL Connect Example.");
Connection conn = null;
try {
String driver = "net.sourceforge.jtds.jdbc.Driver";
Class.forName(driver).newInstance();
//test = com.microsoft.sqlserver.jdbc.SQLServerDriver.class;
String connString = "jdbc:jtds:sqlserver://server_ip_address :198.168.0.10/tracebaledb;encrypt=fasle;user=sa;password=SqlServer2005;instance=SQLEXPRESS;";
String username = "sa";
String password = "SqlServer2005";
conn = DriverManager.getConnection(connString,username,password);
Log.w("Connection","open");
Statement stmt = conn.createStatement();
ResultSet reset = stmt.executeQuery("select * from AD_Login");
//Print the data to the console
while(reset.next()){
Log.w("Data:",reset.getString(3));
Log.w("Data",reset.getString(2)); }
conn.close();
} catch (Exception e)
{
Log.w("Error connection","" + e.getMessage());
}
}
}