2
votes

have problem with Firebird. I have never work with DB. DB on server firebird 1.5.

  1. Add lib: firebird-full-2.2.4 to libs folder

  2. Add this to Gradle: implementation fileTree('libs')

  3. Add this to MainActivity:

    Class.forName("org.firebirdsql.jdbc.FBDriver")
    
    val connection = DriverManager.getConnection(
    "jdbc:firebirdsql://jdbc:firebirdsql:193.###.###.13/3050:Scool",
    "###", "###")
    connection.close()
    
  4. After start I have this:

E/AndroidRuntime: FATAL EXCEPTION: main Process: success.kneu, PID: 12219 java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/resource/Referenceable; at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:400) at java.lang.Class.forName(Class.java:326) at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48) at android.view.View.performClick(View.java:5647) at android.view.View$PerformClick.run(View.java:22465) at android.os.Handler.handleCallback(Handler.java:754) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:163) at android.app.ActivityThread.main(ActivityThread.java:6238) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) Caused by: java.lang.ClassNotFoundException: javax.resource.Referenceable at java.lang.VMClassLoader.findLoadedClass(Native Method) at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742) at java.lang.ClassLoader.loadClass(ClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:400)  at java.lang.Class.forName(Class.java:326)  at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48)  at android.view.View.performClick(View.java:5647)  at android.view.View$PerformClick.run(View.java:22465)  at android.os.Handler.handleCallback(Handler.java:754)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:163)  at android.app.ActivityThread.main(ActivityThread.java:6238)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)  Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/Referenceable; at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:400)  at java.lang.Class.forName(Class.java:326)  at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48)  at android.view.View.performClick(View.java:5647)  at android.view.View$PerformClick.run(View.java:22465)  at android.os.Handler.handleCallback(Handler.java:754)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:163)  at android.app.ActivityThread.main(ActivityThread.java:6238)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)  Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.Referenceable" on path: DexPathList[[zip file "/data/app/success.kneu-1/base.apk", zip file "/data/app/success.kneu-1/split_lib_dependencies_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_0_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_1_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_2_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_3_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_4_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_5_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_6_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_7_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_8_apk.apk", zip file "/data/app/success.kneu-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/success.kneu-1/lib/arm64, /system/lib64, /vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:400)  at java.lang.Class.forName(Class.java:326)  at success.kneu.LoginActivity$onCreate$1.onClick(LoginActivity.kt:48)  at android.view.View.performClick(View.java:5647)  at android.view.View$PerformClick.run(View.java:22465)  at android.os.Handler.handleCallback(Handler.java:754)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:163)  at android.app.ActivityThread.main(ActivityThread.java:6238)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)  2019-07-14 17:37:03.815 12219-12219/? I/Process: Sending signal. PID: 12219 SIG: 9

1
As you are using JDBC on Android please read: JDBC vs Web Service for AndroidMorrison Chang
If you have a firebird-full-2.2.4.jar, it could be a jar from a questionable source, because the normal distribution calls it jaybird-full-2.2.4.jar.Mark Rotteveel

1 Answers

4
votes

Jaybird, the Firebird JDBC driver, does not work on Android. There is an Android port of Jaybird, but it is not maintained by the Jaybird team.

The error itself indicates a problem with loading the connector-api because of missing JNDI classes like javax.naming.Referenceable in Android. This would indicate that you are trying to use the normal Jaybird and not the Android port of Jaybird.

Try and replace your Jaybird dependency with one from the Android port.

Be aware though that in general you should not use JDBC drivers to connect to a database from Android. See also JDBC vs Web Service for Android.