Hello,
I'd like to use H2 linked table function to data migration in way
insert into "linked target" as select from "linked source".
It will be very helpfull for our customers.
Technically it works , but I found some problems/issues(or maybe my
misaunderstanidg)
1) Autocommit . Setting autocommit off sets autocommit only on
TableLinkConnection object. But real connection is stored in
TableLinkConnection conn property and so , remains "autocommited" by
default. At least for Oracle driver, which I use.
To fix it I did some modification :
a) to TableLinkConnection.setAutoCommit added
this.conn.setAutoCommit(mode);
b) It looks like the commit statement has no affect on linked table so
the previous change have caused the new issue - data was commited only on
disconnected from the database (I'm not sure why , but maybe it's oracle's
driver default bechavior to commit unsaved changes on closing of
connection). In any case it's very problematic , so I have added another
changes to
Insert class insertRows() function
if table instanceof TableLink and autocommit is disabled
do commit
just before
table.fire(
the same change is in
MergeUsing.update
2) Prepared statement
The LinkedIndex.add function (which builds sql) , appends "NULL" in value
list every time when value is NULL. So for 10 rows with different columns
with null value different sqls will be generated and so different prepared
stetements. So just now I have changed
//buff.append("NULL");
buff.append('?');
params.add(v);
and
prep.clearParameters(); in TableLink.execute in case and prepared statement
is from pool
So,
Is it possible to make changes in the core
to set autocommit on real connection and execute real connection commit on
COMMIT command(looks like logically it's a correct behavior ) ?
and generate sql for prepared statements independent from the values ?
And if it can take a long, I want to understand if I'm allowed(by license)
to provide to my customers my modified version meanwhile ?
Thanks in advance ,
Marat
--
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 h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/332dfeb2-dc07-4622-9ede-7c0962cc4792n%40googlegroups.com.