If I insert large tables from H2 to Oracle, I get a out of memory exception
insert into oracletable select * from h2table;
Workaround
String insStatement = "INSERT INTO " + importSchema + "." +
tableName + " SELECT " + columnlist + " FROM " + tableName + " LIMIT " +
selectlimit + " OFFSET ";
while(i<=count)
{
stat.execute("CREATE LINKED TABLE IF NOT EXISTS " + importSchema +
"." + tableName + "('" + oracleDriver + "','" + oraJdbcUrl + "','" +
oraUsername + "','" + oraPassword + "','" + importSchema + "." + tableName
+ "')");
int rows1 = stat.executeUpdate(insStatement + offset);
rows = rows + rows1;
i = i +1;
offset = (i-1)*selectlimit;
stat.execute("DROP TABLE IF EXISTS " + importSchema + "." +
tableName); // Drop linked table to avoid out of memory error
}
We can only avoid out of memory exceptions if we drop the linked table
after every insert
--
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.