Copying Data from One H2 database to Another H2 database

1,194 views
Skip to first unread message

Sanjeev Sharma

unread,
Jul 13, 2012, 11:58:32 AM7/13/12
to h2-da...@googlegroups.com
Folks:
I have a requirement to copy data from a few tables from an existing H2 database into a new H2 database.  I would like to know the best, most-performant way to do this.  I know backup/restore does this - but it does the entire database - my requirement to do it only a chosen set of source tables to a chosen set of destination tables in a different H2 database instance.
Any response is highly appreciated.
Thanks

Thomas Mueller

unread,
Jul 16, 2012, 2:43:13 AM7/16/12
to h2-da...@googlegroups.com
Hi,

A good solution is to use "create table as select...". The source table can be in a different database; you would have to create a "linked table" in the target database ("created linked table"). See also the "link_schema" function.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages