Willena / sqlite-jdbc-crypt

SQLite JDBC Driver with encryption support
Apache License 2.0
174 stars 33 forks source link

java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8 #8

Closed camhart closed 5 years ago

camhart commented 6 years ago

Windows 10, running openjdk 11 (64 bit). Running version 3.22 using AES256.

At first glance I thought it was related to https://github.com/xerial/sqlite-jdbc/issues/351 or https://github.com/xerial/sqlite-jdbc/issues/269... but I'm not sure for two reasons:

  1. Those issues have been closed for quite some time. I believe the fixes should be in the code already.
  2. The issues seem to be related to multithreading... This is occuring in my main method which is only being called the one time.

I cannot reproduce it--got the stack trace from a bug report.

Relevant stack trace:

java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V
        at org.sqlite.core.NativeDB._open_utf8(NativeDB.java:-2)
        at org.sqlite.core.NativeDB._open(NativeDB.java:71)
        at org.sqlite.core.DB.open(DB.java:174)
        at org.sqlite.core.CoreConnection.open(CoreConnection.java:220)
        at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:25)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
        at org.sqlite.JDBC.createConnection(JDBC.java:114)
        at org.sqlite.JDBC.connect(JDBC.java:88)
        at java.sql.DriverManager.getConnection(Unknown:-1)
        at java.sql.DriverManager.getConnection(Unknown:-1)

Any ideas? Will the newest release potentially fix this? Will you get jar's out for the newest release or do I need to build myself?

Edit: looks like there are more issues still open that could be relevant: https://github.com/xerial/sqlite-jdbc/issues/337 and https://github.com/xerial/sqlite-jdbc/issues/225

Willena commented 6 years ago

@camhart

I've quickly checked issues that your are referencing, and as you said, the code itself is exactly the same as xerial repo. The only thing that changes is the SQLite native library that is inside the jar. I personally never encountered this error.

niktsar@69a5741 => this solution is already implemented in the original source code.

I might have missed one flag at compilation time. I'll check that soon.

Will the newest release potentially fix this? Will you get jar's out for the newest release or do I need to build myself?

I currently have some problems (most of them are solved by using a newer gcc-version) with the cross-compilation for some platforms ( arm based build especially). This is why there is not a new jar for the moment. If you are targeting 32/64bit "x86" platforms on Windows or Linux you could eventually try to build it yourself. For that you will need docker and you will have to make changes at line 101 of the Makefile in order to select the desired platforms.

One thing to note : wxSQLite3 introduced in version 4.0.0 the ability to have multiple encryption algorithm, and therefore the default algorithm is not AES. It has switched to CHACHA20. For more information on how to use and set cipher I will redirect you to the wxSQLite3 readme : https://github.com/utelle/wxsqlite3/tree/master/sqlite3secure. If you want the old algorithm as default cipher type, It is possible to change the default algorithm. If you want AES256 you will just have to change line 64 of the Makefile to -DCODEC_TYPE=CODEC_TYPE_AES256 and if it is not compatible with your existing databases, you might need to add -DWXSQLITE3_USE_OLD_ENCRYPTION_SCHEME

Willena commented 6 years ago

@camhart I've solved all problems and created a new release with SQLite 3.25.3 and all the improvement from the wxSQLite repo. The note at the end of my previous comment is still applicable. If any issue let me know.

camhart commented 5 years ago

Thanks for this!