How do I import data into an in-memory database?
H2 maintains a custom database url that initialized the database from a SQL script file :
"jdbc:h2:mem;INIT=RUNSCRIPT FROM '~/create.sql'"
HSQLDB and Apache Derby do not support such a feature as far as I know.
a source to share
Take a look at the free "universal database converter" http://eva-3-universal-database-converter-udc.optadat-com.qarchive.org/ - it claims to support MySQL, MS-SQL and HSQLDB, among others.
a source to share
It really depends on how you think. Is there a tool that can do this automatically without programming? May be.
Do you want to develop it? Then find out if your favorite language supports both database engines (standard and in memory), and if so, just write a script that does it. Process everything in chunks (fetch n lines at a time, then insert them, repeat). How big is the piece? It's up to you, try different sizes (say 100, 500, 1k, etc.), see which one works best on your hardware, fine tuning for the sweet spot.
If your favorite language, on the other hand, doesn't support both of them, try using something that does.
a source to share
Recent versions of HSQLDB allow you to open CSV (Comma Separated Values) or other delimiter data file as a TEXT TABLE in HSQLDB, even with mem: databases, which can then be copied to other tables.
As others have noted, there are also supported and supported third party tools for this purpose.
a source to share