Linked table issues (autocommit, prepared statement) ,modifications and licensing

24 views
Skip to first unread message

Marat Akselrod

unread,
May 2, 2024, 3:06:50 AMMay 2
to H2 Database
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

Noel Grandin

unread,
May 3, 2024, 3:36:55 AMMay 3
to h2-da...@googlegroups.com


On 5/1/2024 10:10 PM, Marat Akselrod wrote:
>
> 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 ?
>

Yes you are
Reply all
Reply to author
Forward
0 new messages