From: Angelo Neuschitzer <an@jenomics.net>
To: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Strange behavoir of batches
Date: Tue, 13 Sep 2005 09:07:56 +0200
Message-ID: <43267ACC.1020307@jenomics.net> (raw)
In-Reply-To: <4325FA5D.2060402@opencloud.com>
References: <20050907165251.35F37F1098@svr2.postgresql.org>
<43205847.8050405@archonet.com>
<43255496.5020703@jenomics.net>
<43255EDB.6000306@jenomics.net>
<4325FA5D.2060402@opencloud.com>
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@jenomics.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: an@jenomics.net, oliver@opencloud.com
Subject: Re: Strange behavoir of batches
In-Reply-To: <43267ACC.1020307@jenomics.net>
References: <20050907165251.35F37F1098@svr2.postgresql.org> <43205847.8050405@archonet.com> <43255496.5020703@jenomics.net> <43255EDB.6000306@jenomics.net> <4325FA5D.2060402@opencloud.com> <43267ACC.1020307@jenomics.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox