I am working with android 4.1.1, IDE= eclipse, and SQL Server 2008.
Device= Note 2
android:minSdkVersion="10"
When I run the code snippet on the UI thread It gives me the error "Unable to get information from SQL Server:", but if I run the code in a background thread or AsyncTask Thread it works. Any help in understanding the two processes would be greatly appreciated?
Note: "The issue occurred when I upgrade the minSDKVersion from 8 to 10."
public Boolean open() {
Boolean res = false;
try {
String s = "jdbc:jtds:sqlserver://" + "xx.xxx.x.xx" + "/" + "FOO" + ";instance=SQLEXPRESS";
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = DriverManager.getConnection(s, "UserFoo", "1234");
res = true;
} catch (SQLException sx) {
Log.e(TAG, "DB:Open - " + sx.toString());
} catch (ClassNotFoundException e) {
Log.e(TAG, "DB:Open - " + e.toString());
}
return res;
}