WbCopy/WbImport with batchSize/commitBatch parameters reports wrong error row

5 views
Skip to first unread message

Enrico Briozzi

unread,
Sep 2, 2022, 3:57:25 AMSep 2
to sql-workbench
Hi Tomas,
I'm using SQL Workbench/J build 128.3 with openjdk version "17.0.4"
(64 bit) in Ubuntu 22.04.

I'm using WbCopy and WbImport with batchSize and commitBatch=true parameters.
I'm using very often WbCopy on Oracle DB, but I think the problem is
the same for other DB...

If there is an error in importing one row (e.g. PRIMARY KEY violation)
the messages not report the correct row with error.

Suppose batchSize=1000 the program reports that the row with error is
always a multiple of 1000 (in general a multiple of batchSize) and the
"Values for input file" is not the row with the problem but another (I
think the same for the number).

If I use the same command without batchSize and commitBatch I can find
the correct row (number and values) in the error messages.

In attach you can find an example to reproduce the error. In test.sql
the script to create the table and to import the data file, in
test.csv the data file with a key duplicated in row 8 (value 03;CC).

If you run WbImport with batchSize/commitBatch the wrong message is:
Error importing row 10
Values from input file: 09;II
If you run WbImport without batchSize/commitBatch the correct message is:
Error importing row 8
Values from input file: 03;CC

Thank you very much, best regards
Enrico.-
test.sql
test.csv

Thomas Kellerer

unread,
Sep 2, 2022, 7:48:59 AMSep 2
to sql-wo...@googlegroups.com
> If there is an error in importing one row (e.g. PRIMARY KEY violation)
> the messages not report the correct row with error.

I know, but there is nothing I can do about.

The driver (or actually the database) doesn't give me that information.

I send e.g. 1000 rows to the database, and the databases answers with "one of them failed".

I haven't checked, but the row number probably matches the _first_ row of the batch.

Regards
Thomas

Enrico Briozzi

unread,
Sep 2, 2022, 9:02:34 AMSep 2
to sql-workbench
Hi Tomas,
> The driver (or actually the database) doesn't give me that information.
> I send e.g. 1000 rows to the database, and the databases answers with "one of them failed".
I understand... It is a pity. The correct information about the error
will be very useful in a block of 1000, or more, rows...

> I haven't checked, but the row number probably matches the _first_ row of the batch.
From my example the row number, and the value, is the last one of the
block (batchSize=5 give me error on row 10 instead of 8).
Reply all
Reply to author
Forward
0 new messages