Hi all. Like object i have some problem with jdbc driver. I wanna connect to a database server (postgresql) without write some php script server side to comunicate with client (android mobile phone), so can i use this driver?
http://jdbc.postgresql.org/ I try it in a normal java program and it works very well but when I use this library in android program I have this exception (logcat paste): 08-24 08:15:11.072: INFO/ActivityManager(568): Starting activity: Intent { flags=0x10000000 comp={com.prova.pgsql/ com.prova.pgsql.PGSQL} } 08-24 08:15:11.132: INFO/ActivityManager(568): Start proc com.prova.pgsql for activity com.prova.pgsql/.PGSQL: pid=767 uid=10023 gids={} 08-24 08:15:11.152: DEBUG/AndroidRuntime(760): Shutting down VM 08-24 08:15:11.152: DEBUG/dalvikvm(760): DestroyJavaVM waiting for non- daemon threads to exit 08-24 08:15:11.172: DEBUG/dalvikvm(760): DestroyJavaVM shutting VM down 08-24 08:15:11.172: DEBUG/dalvikvm(760): HeapWorker thread shutting down 08-24 08:15:11.172: DEBUG/dalvikvm(760): HeapWorker thread has shut down 08-24 08:15:11.172: DEBUG/jdwp(760): JDWP shutting down net... 08-24 08:15:11.172: DEBUG/jdwp(760): +++ peer disconnected 08-24 08:15:11.172: INFO/dalvikvm(760): Debugger has detached; object registry had 1 entries 08-24 08:15:11.182: DEBUG/dalvikvm(760): VM cleaning up 08-24 08:15:11.232: DEBUG/dalvikvm(760): LinearAlloc 0x0 used 639228 of 4194304 (15%) 08-24 08:15:11.362: INFO/jdwp(767): received file descriptor 20 from ADB 08-24 08:15:11.451: DEBUG/dalvikvm(541): GC freed 264 objects / 9912 bytes in 329ms 08-24 08:15:11.682: DEBUG/dalvikvm(541): GC freed 40 objects / 1696 bytes in 212ms 08-24 08:15:11.792: DEBUG/dalvikvm(541): GC freed 2 objects / 48 bytes in 107ms 08-24 08:15:11.892: INFO/dalvikvm(767): Failed resolving Lorg/ postgresql/jdbc4/Jdbc4SQLXML; interface 131 'Ljava/sql/SQLXML;' 08-24 08:15:11.892: WARN/dalvikvm(767): Link of class 'Lorg/ postgresql/ jdbc4/Jdbc4SQLXML;' failed 08-24 08:15:11.892: ERROR/dalvikvm(767): Could not find class 'org.postgresql.jdbc4.Jdbc4SQLXML', referenced from method org.postgresql.jdbc4.AbstractJdbc4Connection.createSQLXML 08-24 08:15:11.892: WARN/dalvikvm(767): VFY: unable to resolve new- instance 391 (Lorg/postgresql/jdbc4/Jdbc4SQLXML;) in Lorg/postgresql/ jdbc4/AbstractJdbc4Connection; 08-24 08:15:11.892: WARN/dalvikvm(767): VFY: rejecting opcode 0x22 at 0x0000 08-24 08:15:11.892: WARN/dalvikvm(767): VFY: rejected Lorg/ postgresql/ jdbc4/AbstractJdbc4Connection;.createSQLXML ()Ljava/sql/SQLXML; 08-24 08:15:11.892: WARN/dalvikvm(767): Verifier rejected class Lorg/ postgresql/jdbc4/AbstractJdbc4Connection; 08-24 08:15:11.892: DEBUG/AndroidRuntime(767): Shutting down VM 08-24 08:15:11.892: WARN/dalvikvm(767): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) 08-24 08:15:11.892: ERROR/AndroidRuntime(767): Uncaught handler: thread main exiting due to uncaught exception 08-24 08:15:11.902: ERROR/AndroidRuntime(767): java.lang.VerifyError: org.postgresql.jdbc4.AbstractJdbc4Connection 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at org.postgresql.Driver.makeConnection(Driver.java:393) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at org.postgresql.Driver.connect(Driver.java:267) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at java.sql.DriverManager.getConnection(DriverManager.java:192) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at java.sql.DriverManager.getConnection(DriverManager.java:228) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at com.prova.pgsql.PGSQL.onCreate(PGSQL.java:32) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1123) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2231) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2284) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.os.Handler.dispatchMessage(Handler.java:99) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.os.Looper.loop(Looper.java:123) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at android.app.ActivityThread.main(ActivityThread.java:3948) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invokeNative(Native Method) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invoke(Method.java:521) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 08-24 08:15:11.902: ERROR/AndroidRuntime(767): at dalvik.system.NativeStart.main(Native Method) 08-24 08:15:11.912: INFO/Process(568): Sending signal. PID: 767 SIG: 3 08-24 08:15:11.932: INFO/dalvikvm(767): threadid=7: reacting to signal 3 08-24 08:15:11.962: INFO/dalvikvm(767): Wrote stack trace to '/data/ anr/traces.txt' 08-24 08:15:20.555: INFO/Process(767): Sending signal. PID: 767 SIG: 9 08-24 08:15:20.572: INFO/ActivityManager(568): Process com.prova.pgsql (pid 767) has died. This is the program: package com.prova.pgsql; import java.sql.*; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class PGSQL extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv; tv = (TextView) this.findViewById(R.id.main); TextView tv2; tv2 = (TextView) this.findViewById(R.id.url); try { Class.forName("org.postgresql.Driver"); tv.setText("Registered the driver ok, so let's make a connection."); Connection c = null; c = DriverManager.getConnection ("jdbc:postgresql://192.168.0.2/ postgres", "postgres", "alessio"); tv2.setText("jdbc:postgresql://192.168.0.2/ postgres"+ "postgres"+ "alessio"); DatabaseMetaData dbmd; dbmd = c.getMetaData(); //get MetaData to confirm connection tv2.setText("Connection to "+dbmd.getDatabaseProductName()+" "+ dbmd.getDatabaseProductVersion()+" successful.\n"); if (c != null) tv.setText("Hooray! We connected to the database!"); else tv.setText("We should never get here."); } catch (SQLException se) { tv.setText("Couldn't connect: print out a stack trace and exit."); se.printStackTrace(); //System.exit(1); } catch (ClassNotFoundException cnfe) { tv.setText("Couldn't find driver class:"); System.err.println("Couldn't find driver class:"); cnfe.printStackTrace(); } } } Anyone can help me? Thanks in advance Ale --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---