On 2/01/2014 12:43 PM, Rob Oaks wrote:
Thank you both for your assistance.
Ryan, it’s comforting to know that someone has accomplished something
similar, which inclines me to go ahead and build a prototype. I have
just a couple more questions:
1.
I would prefer to avoid generating/transmitting a file, unless
there is a compelling architectural rationale, as that will
complicated the Web Service/queueing architecture. My plan would
be to SCRIPT the database to a string and compress the string
(e.g. using GZIPOutputStream). The string would then be sent via
RESTful service, queued, dequed, decompressed, and sent to
RUNSCRIPT to recreate the H2 database in-memory. Does this seem
reasonable (again remembering that the string is typically 10-30K
and will really never exceed 100K)?
If you run SCRIPT without a file, it returns the script in a result set.
You can then get the string, zip it, BASE64 encode if you need, and do
what you like with it.
1.
Rembering that I’m competely new to H2, I want to make sure H2
supports dynamic SCRIPT/RUNSCRIPT calls, not just command line
usage, and that your experience doing that has been positive.
Yes, you just issue the SQL command.
http://www.h2database.com/html/grammar.html#script
http://www.h2database.com/html/grammar.html#runscript
RUNSCRIPT accepts a file, so you probably just want to read your script
in and execute each SQL command manually rather than using RUNSCRIPT. It
says it can also accept a URL, but I'm not quite sure if you could
utilise that in any way.
Script (and runscript) have built in support for compression, but I
think that only works when writing to a file, not in-memory.
Would be nice if there was some java in-memory file abstraction, so you
could just use the file support already in H2 and not have to worry
about compressing and manually running the sql commands.
Anything else I should watch out for?
I think it is pretty straight forward :) and at a conceptual level seems
pretty sound. All the best.
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.