Interesting find. That driver is more up to date than the Xerial one found here https://github.com/xerial/sqlite-jdbc. As of this writing Xerial is at 3.27.2.1 (even though the readme.md shows 3.28) and this one is at 3.30.0 (just a tad behind SQLite's current version of 3.30.1).
A quick read of the docs seem to suggest that. It seems to even be compatible with SQLCipher. Cool thing is that this would require no wrapper (such as in the case of SQLCipher: https://www.b4x.com/android/forum/t...ryption-with-sqlcipher-library.14965/#content). Due to today's work load, I'll be unable to play with this, but technically all you have to do is put the .jar file in the Additional Libraries folder, include it in your project and start playing with it. Looks like the initial encryption is handled with SQL statements and then the encrypted database is opened via parameters passed along in the JDBC URL.So, can it be used instead of 3.7.2 sqlite version in order to encrypt a database?
Don't use InitializeSQLite. Use Initialize or Initialize2. Something likeThank you for answering, but initializing jSQL for sqlite, does not allow you to pass any JDBC URL. Maybe needs a new wrapper for jSQL?
sql.Initialize("com.sqlite.JdbcUrl","jdbc:sqlite:test.db")
Thank you very much.Don't use InitializeSQLite. Use Initialize or Initialize2. Something like
That should open an unencrypted test.db SQLite database file that is located in the same directory as the the program file (.jar) or, while developing, in the Objects directory of your project. Note: The test.db must exist, so you either need to use InitializeSQLite to create the database file or another external program. Once you open the unencrypted DB, you can encrypt it as per documentation. You then need to change the URL to include the encryption parameters so the driver can properly open your database.B4X:sql.Initialize("com.sqlite.JdbcUrl","jdbc:sqlite:test.db")
'REMOVE this line, if exists
#AdditionalJar: sqlite-jdbc-3.7.0
'add this line on Project Attributes. if there is newer version, just change version number
#AdditionalJar: sqlite-jdbc-3.30.0
'add this at AppStart
SQL.Initialize("org.sqlite.JDBC","jdbc:sqlite:file:data.db?cipher=sqlcipher&legacy=1&kdf_iter=4000&key=YOURKEY")
Good morning Erel, i think this jdbc driver should be default at jSQL library about sqlite. It could be [B4X] solution because supports all operating systems and encryptions.Something that you should be aware of: if you don't initialize it with InitializeSQLite then the library will not prevent multiple non-query commands to be executed concurrently if you are using the async methods. It shouldn't be too complicated to take care of this in your app.
1) If in the jSQL library (I'm looking at the source here: https://github.com/AnywhereSoftware/B4J_SQL/blob/master/src/anywheresoftware/b4j/objects/SQL.java)Something that you should be aware of: if you don't initialize it with InitializeSQLite then the library will not prevent multiple non-query commands to be executed concurrently if you are using the async methods. It shouldn't be too complicated to take care of this in your app.