I had added the network permissions and add jtds-1.3.1.jar to the libs driectory.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
But when I getConnection, it appears the exception message(android.os.NetworkOnMainThreadException) at DriveManager.getConnection. Does somebody know what I lose to set?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViews();
}
private void findViews()
{
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
con = DriverManager.getConnection(URL, USER, PASSWORD);
}
catch (Exception e)
{
Log.w("Error connection","" + e.getMessage());
}