Open encrypted sqlite database file with java

I want to know with which java lib my java code could  can connect to a encrypted database.
fxp007Asked:
Who is Participating?
 
CEHJCommented:
This appears to support encryption

http://www.ch-werner.de/javasqlite/SQLite/Database.html
0
 
objectsCommented:
you would use jdbc to access database
0
 
CEHJCommented:
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
fxp007Author Commented:
I'm afraid that it doesn't support open encrypted database.
0
 
CEHJCommented:
How is the db being encrypted?
0
 
fxp007Author Commented:
I don't know how, but I can open it with SharpPlus Sqlite Developer 3.6.5 with password
0
 
fxp007Author Commented:
And I can read some part of it (except date type data) with a C# sqlite lib.
0
 
fxp007Author Commented:
Thanks, I've tried this, but it doesn't work.
I use the key(string) function but it failed still with exception:
error: SQLite.Exception: file is encrypted or is not a database

I found the key function in java doc said:
Not available in public releases of SQLite.

I don't quite understand with what does the "public releases" refers to.
SQLite.Database db = new SQLite.Database();
try {
 db.key("password");
 db.open("d:\\database.dat", SQLite.Constants.SQLITE_OPEN_READONLY);
	    System.out.print(db.get_table("select * from MessageBody"));
 } catch (java.lang.Exception e) {
	    System.err.println("error: " + e);

Open in new window

0
 
objectsCommented:
its not a standard feature so its probably not going to be built in to most drivers
(to access from java) you may need to either remove the encryption or using a different database
0
 
CEHJCommented:

>>I don't quite understand with what does the "public releases" refers to.

Could mean there are paid versions that support it.

Derby supports encryption afaik
0
 
fxp007Author Commented:
Or it means I need to change a jdbc driver for sqlite?
0
 
objectsCommented:
> Or it means I need to change a jdbc driver for sqlite?

you need a driver that supports encryption and I'm not aware of one. Probably because its not a standard feature. If you you need encryption then I mention above you could use a db that supports it out of box (eg. derby), or if you don't need encryption then just get rid of it.
0
 
fxp007Author Commented:
I know the reason but not solve the probem
0
 
CEHJCommented:
Is that sorted out?
0
 
fxp007Author Commented:
No, but I changed to using C# with sqlite.NET instead.Thank you anyway
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.