Reputation: 5881
HSQLDB allows insertion of data from a query (or table) into another table like this:
INSERT INTO dest SELECT * FROM source;
Now what if I access two databases from a Java application, each over a separate connection, and dest
is in one while source
is in the other? Do I have to do everything by hand (run the SELECT
query on source
, iterate over the result set and insert each record into dest
), or is there a shortcut?
Upvotes: 0
Views: 198
Reputation: 24352
There is no shortcut.
You can write a method that uses getObject() for the column values from rows of a ResultSet and sets the parameters of a PreparedStatement before calling addBatch() for each row and executeBatch() at the end.
Upvotes: 1