I have to create such a mechanism:
- Create in-memory (H2DB) database;
- Create tables and fill them using some data;
- Get stream to that database;
- Send that stream via WebDAV or something else;
I know everything except that “How to get stream to “in-memory” database created via H2DB”?
And some explanations:
- I can’t create file because of some server restrictions;
- I need that stream to create a file;
You can create the SQL script from a database using org.h2.tools.Script.execute(String url, String user, String password, OutputStream out). This works even for in-memory databases.
You can use the so called ‘in-memory file system‘. To get the file as a stream, you would need to use the internal H2 file API however (org.h2.IOUtils.openFileInputStream).