In my Android project I'm using jtds.jdbc for connecting to SQL Server database. While trying to connect I wrote wrong connection string which threw an error saying: "Network error IOException: Connection timed out
".
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
Connection DbConn = DriverManager.getConnection(192.168.xx.xx:1085/SomeDatabase;integratedSecurity=true;user=xxx;password=xxx;instanceName=SomeInstance);
Statement stmt = DbConn.createStatement();
ResultSet reset = stmt.executeQuery(" select * from SomeTable");
Log.i("RESULTS", reset.getString(1));
DbConn.close();
This proved that JTDS is included and working in my project. But when I wrote correct connection string, I got the following errors:
11-28 08:09:31.929: I/dalvikvm(13041): Could not find method org.ietf.jgss.GSSManager.getInstance, referenced from method net.sourceforge.jtds.jdbc.TdsCore.createGssToken
11-28 08:09:31.929: W/dalvikvm(13041): VFY: unable to resolve static method 7980: Lorg/ietf/jgss/GSSManager;.getInstance ()Lorg/ietf/jgss/GSSManager;
11-28 08:09:31.929: D/dalvikvm(13041): VFY: replacing opcode 0x71 at 0x0001
11-28 08:09:31.929: D/dalvikvm(13041): VFY: dead code 0x0004-0090 in Lnet/sourceforge/jtds/jdbc/TdsCore;.createGssToken ()[B
11-28 08:09:31.949: I/dalvikvm(13041): Could not find method org.ietf.jgss.GSSContext.initSecContext, referenced from method net.sourceforge.jtds.jdbc.TdsCore.sendGssToken
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to resolve interface method 7974: Lorg/ietf/jgss/GSSContext;.initSecContext ([BII)[B
11-28 08:09:31.949: D/dalvikvm(13041): VFY: replacing opcode 0x72 at 0x0008
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to resolve exception class 1082 (Lorg/ietf/jgss/GSSException;)
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to find exception handler at addr 0x4c
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejected Lnet/sourceforge/jtds/jdbc/TdsCore;.sendGssToken ()V
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejecting opcode 0x0d at 0x004c
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejected Lnet/sourceforge/jtds/jdbc/TdsCore;.sendGssToken ()V
11-28 08:09:31.949: W/dalvikvm(13041): Verifier rejected class Lnet/sourceforge/jtds/jdbc/TdsCore;
11-28 08:09:31.949: D/AndroidRuntime(13041): Shutting down VM
11-28 08:09:31.949: W/dalvikvm(13041): threadid=1: thread exiting with uncaught exception (group=0x40018560)
11-28 08:09:32.189: E/AndroidRuntime(13041): FATAL EXCEPTION: main
11-28 08:09:32.189: E/AndroidRuntime(13041): java.lang.VerifyError: net.sourceforge.jtds.jdbc.TdsCore
11-28 08:09:32.189: E/AndroidRuntime(13041): at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:359)
11-28 08:09:32.189: E/AndroidRuntime(13041): at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.sql.DriverManager.getConnection(DriverManager.java:180)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.sql.DriverManager.getConnection(DriverManager.java:145)
11-28 08:09:32.189: E/AndroidRuntime(13041): at fip.cis.k.PostavkeActivity$1.onClick(PostavkeActivity.java:50)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.view.View.performClick(View.java:2501)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.view.View$PerformClick.run(View.java:9107)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Handler.handleCallback(Handler.java:587)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Handler.dispatchMessage(Handler.java:92)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Looper.loop(Looper.java:130)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.app.ActivityThread.main(ActivityThread.java:3835)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.lang.reflect.Method.invoke(Method.java:507)
11-28 08:09:32.189: E/AndroidRuntime(13041): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
11-28 08:09:32.189: E/AndroidRuntime(13041): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-28 08:09:32.189: E/AndroidRuntime(13041): at dalvik.system.NativeStart.main(Native Method)
My jtds-1.3.1.jar is in libs folder and in Android Private Libraries and checked in Order and Export.
GSSManager is a class from Java. But I do have jre7 included in the build.
I did try:
Any suggestions?
EDIT: sendGssToken() method is found in both org.ietf.jgss.GSSManager and net.sourceforge.jrds.jdbc.TdsCore classes
I just used an eariler jar and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With