Hi,
I'm trying to migrate a GeoTools module using the HSQL db to H2,
because I need better performance.
Now, the migration of the code is done, and the unit tests of the
module, abused as a benchmark, show a 50% speedup (22 seconds H2, 34
seconds HSQL).
So far so good, but there is a catch. This database is not something
the user sees or plays with, it is created on the file in the temp
directory the first time the module is used, and then kept there. To
allow multiple GeoTools applications to use the database at the same
time, in HSQL with add the readonly=true property in the database
property file.
I read in the FAQ that to make a database read only one has to use the
operating system. This is very inconvenient, and not fully true...
File.setReadOnly() may allow to make a file read only, but then there
is no command to make it read write, and some time this is needed. In
particular, when we ship a new release of the module, the database
contents may change, and we keep a version number around, if the
cached database in the temp directory has a lower number, it gets
wiped out and recreated. This works with HSQL because the connection
to the db is read only, but not the files...
Any change we can get a similar behaviour from H2? Maybe through a
connection parameter, I don't know, any programmatic way is good.
Cheers
Andrea Aime