Re: Strange behavoir of batches

From: Angelo Neuschitzer <an(at)jenomics(dot)net>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Strange behavoir of batches
Date: 2005-09-13 07:07:56
Message-ID: 43267ACC.1020307@jenomics.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

Yes, I know, I found the problem for me already.
If one does call addBatch() every time it works fine.
But thats not the point.
If I don't do it (there should be 1 line missing each block) but fiddle
around with the second block
{ // original
insert 82 rows (in table B)
2 (in table C)
9 (in table D)
{
{ // changed
2 (in table C)
9 (in table D)
82 (in table B)
{

it works well...

Also It should not matter at all what is in tables B,C and D if I enter
a reference from A to E... but it seems that it does.
If got some minutes free I'll go and get the old code again to reproduce
some things and write a report.

Zo Phar

Angelo Neuschitzer

Oliver Jowett wrote:

>Angelo Neuschitzer wrote:
>
>
>
>>>PreparedStatemet pStmt = con.prepareStatement("INSERT INTO table_a
>>>VALUES (...)");
>>>for(0 to 93)
>>>{
>>> [fill values into pStmt]
>>> if(not last row)
>>> {
>>> pStmt.addBatch();
>>> }
>>>}
>>>pStmt.executeBatch();
>>>pStmt.clearBatch();
>>>
>>>
>
>AFAIK, this "not last row" logic seems wrong. Calling executeBatch()
>only executes those queries that have been added to the batch via
>addBatch(), so the loop will lose the last INSERT.
>
>-O
>
>
>
>

--
Angelo Neuschitzer
Development

Java. Mit Sicherheit.
Jenomics GmbH, Thalkirchnerstraße 55, 80337 München, Deutschland

www.jenomics.de an(at)jenomics(dot)de
Tel: +49 (0) 89 767 59 003; Fax: +49 (0) 89 767 59 005

------------------------------------------------------

Diese Nachricht enthält vertrauliche Informationen und ist
ausschließlich für den Adressaten bestimmt. Der Gebrauch durch Dritte
ist verboten. Jenomics ist nicht verantwortlich für die ordnungsgemäße,
vollständige oder verzögerungsfreie Übertragung dieser Nachricht.

This message may contain confidential information and is intended solely
for the use by the addresse. Use of this communication by others is
prohibited. Jenomics are neither liable for the proper and complete
transmission of the information in this message nor for any delay in its
receipt.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Oliver Jowett 2005-09-13 11:12:03 Re: Strange behavoir of batches
Previous Message Arjen van der Meijden 2005-09-13 06:37:55 Re: Race-condition with failed block-write?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-09-13 11:12:03 Re: Strange behavoir of batches
Previous Message Oliver Jowett 2005-09-12 22:06:25 Re: Strange behavoir of batches