Quiero conectar una aplicacion con sql server, pero me sale el siguiente error. Alguien sabe que puede ser?
07-08 01:27:29.427 3890-3890/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.itasur.julio.sqlserver, PID: 3890
java.lang.VerifyError: net/sourceforge/jtds/jdbc/TdsCore
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:359)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at java.sql.DriverManager.getConnection(DriverManager.java:179)
at java.sql.DriverManager.getConnection(DriverManager.java:144)
at com.itasur.julio.sqlserver.Principal.onCreate(Principal.java:52)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5019)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
07-08 01:32:29.517 3890-3890/? I/Process: Sending signal. PID: 3890 SIG: 9
Mi codigo es el siguiente
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_principal);
ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
Toast.makeText(getApplicationContext(), "Conectado a Internet", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "No Conectado", Toast.LENGTH_SHORT).show();
}
Connection connection = null;
String ConnectionURL, servidor, db, usuario, password;
servidor = "192.168.0.10";
db="db";
usuario="sa";
password="314159265";
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Class.forName("net.sourceforge.jtds.jdbc.Driver");
ConnectionURL = "jdbc:jtds:sqlserver://"+servidor+";databaseName="+db+";user="+usuario+";password="+password+";";
connection = DriverManager.getConnection(ConnectionURL);
} catch (SQLException se) {
Log.e("bug", se.getMessage());
} catch (ClassNotFoundException e) {
Log.e("bug", e.getMessage());
} catch (Exception e) {
Log.e("bug", e.getMessage());
}
}