问题
Do you know a method to encrypt an existing hsql database without loosing it contents?
I want to use it afterwards with the jdbc url
jdbc:hsqldb:file:<database path>;crypt_key=<key>;crypt_type=blowfish
回答1:
The only way to do this is by modifying the code and building a special jar that reads the .script in clear text, but does all the writing with encryption.
With the normal jar, execute SHUTDOWN SCRIPT
on the existing database to turn it into a .script file.
Modify org.hsqldb.persist.Log#processScript() with Crypto crypto = null;
instead of the existing line. Compile the jar using Ant or Gradle.
Open the database with the encryption URL the special jar and execute SHUTDOWN
. This will encrypt the database
Use the normal jar to access the encrypted database.
As this is a useful feature, it may be added to future versions of HSQLDB.
来源:https://stackoverflow.com/questions/10681920/hsqldb-encryption-of-an-existing-database