sqlite-jdbc icon indicating copy to clipboard operation
sqlite-jdbc copied to clipboard

How to protect SQLite database with password.

Open jayakrishna-v opened this issue 7 years ago • 4 comments

Hi,

I am looking for an option to protect the SQLite database being used by one of my applications. The main idea is to protect the database from unauthorized users. This option is available in DOTNET library but the same is not available here.

Please let me know your comments.

jayakrishna-v avatar Mar 27 '18 11:03 jayakrishna-v

In DOTNET package we have a method like - connectoion.setPassword("yourpassword"); And if we need to access the database, we need to mention the password in the connection string. I am expecting this with Java SQLITE driver also. Is there any such option?

jayakrishna-v avatar Mar 28 '18 04:03 jayakrishna-v

@jayakrishna-v There isn't a corresponding feature in sqlite-jdbc directly. You would need to substitute with a SQLite library that is complied with encryption support. A few options include SEE or SQLCipher, or you could try to build your own. Those would not be directly. compatible with the encryption used in the ADO.NET package unless you extracted that out of the ADO.NET provider and implemented your own compatible codec.

sjlombardo avatar Mar 28 '18 21:03 sjlombardo

is this solution working ?

Connection connection = DriverManager.getConnection("jdbc:sqlite:db.sqlite", "", "S3cr3T");

devMls avatar Mar 16 '21 08:03 devMls

Is this still relevant with the latest version? Can we close this?

gotson avatar Jul 29 '22 05:07 gotson

See https://github.com/xerial/sqlite-jdbc/blob/master/USAGE.md#how-to-use-encrypted-databases

gotson avatar Sep 21 '22 07:09 gotson