Hello everyone, I set up JDBC sqlite in Intellij IDEA project on PC. Now I’ll try to set it up on Android in the AIDE application for the sake of sporting interest. I create a Java project and can run Java projects in Android. Actually, as usual I connected sqlite-jdbc.jar to the project and checked the class org.sqlite.JDBC - it is present. I am trying to use the following code to connect to the database, in fact, it should appear along the path /sdcard/test.db :

 Connection dbConn = DriverManager.getConnection(JDBC.PREFIX + "/sdcard/test.db"); 

But I get an error that a suitable driver was not found. Okay, I find the information that you need to load the JDBC class before use. Before getConnection I write Class.forName("org.sqlite.JDBC") and I get an error that the native library libsqlitejdbc.so not found in nativeDirectories . The Android libraries are located in /system/lib and /vendor/lib . I find out what lib I need by

 OSInfo.getNativeLibFolderPathForCurrentOS() 

And I get Linux/androidarm . I go to jar and rip out Linux/android-arm/libsqlitejdbc.so libsqlitejdbc.so from it and drop it into the / system / lib` folder, giving permission as well as to all my neighbors (letter D). I run the program and get an interesting error

 dlopen failed: library '/system/lib/libsqlitejdbc.so' needed or dlopened by '/system/lib/libnativeloader.so' is not accessible for the namespace 'classloader-namespace' 

What to do?) I repeat, purely sports interest)

    1 answer 1

    JDBC in vanilla Android is not working. You need to port the JDBC driver for Android.

    For example, you can use SQLDroid

    • Thanks a lot )) - Flippy