B4J Code Snippet Open Encrypted Sqlite Databases with B4J (SQLCipher)

Download the JDBC from this GitHub, and place it in your Additional folder

In your Main Module, use #AdditionalJar to add your jdbc.

Add JSQL library

The following JDBC has been tested and works fine. You can use any of them
'#AdditionalJar: sqlite-jdbc-3.30.0
'#AdditionalJar: sqlite-jdbc-3.31.1
'#AdditionalJar: sqlite-jdbc-3.35.5.1

'Using the latest Version, you need to download and Add the slf4j API, otherwise you will get Class not found Error
#AdditionalJar: sqlite-jdbc-3.46.0.0
#AdditionalJar: slf4j-api-1.7.36

Find Example Attached
 

Attachments

  • SqlCipher jdbc.zip
    18.8 KB · Views: 129

T201016

Active Member
Licensed User
Longtime User
Hi @mcqueccu
I used your example for testing
And I have to say that there are errors with individual JDBC:


For now, I have not managed to test other (older) JDBC version.

It can be ignored, of course. But adding:
#AdditionalJar: slf4j-nop-1.7.36
I get no warnings whatsoever. Cleaner log.
 
Last edited:

hatzisn

Expert
Licensed User
Longtime User
Hi @mcqueccu. Did you have any luck with the SQLCipher for B4J? I tried your project and it responds that the file is not a sqlite database.

Edit - With 3.7.2 and slf4j-api-1.7.36 it responds that it cannot find the table.
 
Last edited:

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hi @mcqueccu. Did you have any luck with the SQLCipher for B4J? I tried your project and it responds that the file is not a sqlite database.

Edit - With 3.7.2 and slf4j-api-1.7.36 it responds that it cannot find the table.
It works fine. Make sure you using the recommended files
 

Magma

Expert
Licensed User
Longtime User
It works fine. Make sure you using the recommended files
Hi there !!!

well i ve tried your example with many sqlite drivers and with the recommended +slf4j-api-1.7.36... but the result was always the same:
org.sqlite.SQLiteException: [SQLITE_NOTADB] File opened that is not a database file (file is not a database)

I ve checked hundred of times if i was having something different... also tried open with db browser sqlcipher-version your file (and works)...
I ve also used direct path to database... but the same...
The error seems... comes when trying to open... the already founded file (so no path error)... and all seems that will go ok... but something other hits... not decrypting well, not using right the key passphrase in my b4j-jdk version (who knows)...

So I think the problem is deeper... so let's find it..

I am using B4J v10
Open JAVA JDK 19...

what versions are you using ?

ps: if the files are in additional folder (of libs) getting the same error with @hatzisn
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…