gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
194 stars 40 forks source link

Cant get SQLite to work #178

Open NO-ob opened 4 years ago

NO-ob commented 4 years ago

I'm trying to get SQLite to work but it doesn't. I have added

java.sql.Connection java.sql.DriverManager java.sql.Statement java.sql.SQLException java.sql.ResultSet

But when the program tries to connect to the database I get an SQLException which says "Error Opening Connection". It works when running as JavaFx so i'm not sure what the issue is.

I am using the sqlite-jdbc maven plugin

mipastgt commented 4 years ago

In order to get that working I head to add

                <jniList>
                    <list>org.sqlite.core.DB</list>
                    <list>org.sqlite.core.NativeDB</list>
                    <list>org.sqlite.BusyHandler</list>
                    <list>org.sqlite.Function</list>
                    <list>org.sqlite.ProgressHandler</list>
                    <list>org.sqlite.Function$Aggregate</list>
                    <list>org.sqlite.Function$Window</list>
                    <list>org.sqlite.core.DB$ProgressObserver</list>
                </jniList>

                <resourcesList>
                    <list>org/sqlite/native/${sqlite.platform}/${os.arch}/.*</list>
                </resourcesList>

and I did not use any SQLite plugin because I don't know what the interaction with the client-maven-plugin would be. ${sqlite.platform} must be set correctly for your platform. (FreeBSD, Linux, Mac, Windows)

cbm64chris commented 4 years ago

I am looking at a similar problem. I am trying to access a SQLite DB on IOS that I create inside private storage at runtime. Works fine for desktop but I am getting;

Caused by: java.lang.Exception: No native library is found for os.name=iOS and os.arch=arm. path=/org/sqlite/native/iOS/arm
[Sat Jun 20 17:40:43 BST 2020][INFO] [SUB]  at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:335)
[Sat Jun 20 17:40:43 BST 2020][INFO] [SUB]  at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
[Sat Jun 20 17:40:43 BST 2020][INFO] [SUB]  at org.sqlite.core.NativeDB.load(NativeDB.java:63)
[Sat Jun 20 17:40:43 BST 2020][INFO] [SUB]  at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)

I am pulling in 3.31.1 of SQLite in maven, looking at the packages there is no iOS native jni. Is this currently possible?

cbm64chris commented 4 years ago

Wanted to circle back around here - I choose to implement a native java implementation of the SQLite driver (SQLJet), it works just fine on iOS.

mipastgt commented 4 years ago

But SQLJet is not a real database engine.

SQLJet does not support SQL queries; there is an API to work with the database on a lower level.

But for some use-cases this may be ok.

cbm64chris commented 4 years ago

Agreed, but for basic creation, selection, and deletion without the native JNI it does the job fine.

mipastgt commented 4 years ago

Except the license which excludes any commercial use.

kojojo1 commented 3 years ago

I'm struggling with the same issue. @mipastgt Could you provide the complete example pom.xml file for one platform (Mac for example) . It would be awesome.

mipastgt commented 3 years ago

@kojojo1 Sorry, but I cannot provide you with more than I have posted already.