Re: JDBC batching - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: JDBC batching
Date
Msg-id 3C56E2FC.6080108@xythos.com
Whole thread Raw
In response to Re: JDBC batching  ("Tony DeWitt" <dewitt@eizel.com>)
Responses tomcat 4 gurus
Re: JDBC batching
List pgsql-jdbc
Very strange.  I was sure this had been changed in 7.2.  I know there
was a discussion on how to change it on the mail lists, and I thought
that it had been done.  But I guess not.  (although other changes were
made to this code for 7.2, strange).

Anyway, if someone wants to submit a patch against current sources to
add this capability, that would certainly be welcome.  I would also
recommend looking back at the mail list archives for the discussion on
how this should be done, as there are some fine points about the jdbc
spec in this area that are not clear or obvious.  The biggest area of
problem is that if the batch is executed in one call, then the driver
will only get the result (i.e. rowcount) of the last statement in that
batch, instead of getting a result for each statement.  There were some
on the mail list that felt this would be a bug and therefore we couldn't
use a single roundtrip.  However I think upon careful reading of the
jdbc spec this is allowed, but you need to set some special codes that
indicate the result of a particular statement is unknown or something
like that.  This would be a change in behavior since the results of
executing a batch would be different than they currently are so both
methods may need to be supported to avoid breaking existing apps.


Sorry for giving you incorrect information about the status of this, but
I really did think it was already done.

thanks,
--Barry


Tony DeWitt wrote:

> It does not appear to be so. I grabbed 7.2rc2, and the JDBC driver shipped
> with it still implements a batch update with multiple round trips. I
> verified this both by sniffing the network packets, reading the shipped
> code, and disassembling the Statement class that I'm running. I even checked
> the CVS repository at jdbc.postgresql.org.
>
> Am I missing something here?
>
>
> Thanks,
> Tony
>
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Barry Lind
> Sent: Tuesday, January 22, 2002 3:47 PM
> To: Tony DeWitt
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] JDBC batching
>
>
> Tony,
>
> The batch API works in one round trip in 7.2.
>
> thanks,
> --Barry
>
>
> Tony DeWitt wrote:
>
>
>>I have looked through all the documentation that I can find, as well as
>>
> the
>
>>mailing list archives, and I haven't been able to find the answer to this.
>>I'm currently running pgsql 7.0.2.
>>
>>What I'm trying to do is make a large number of writes to a single table
>>
> in
>
>>an efficient way. Currently our code makes a separate request for each
>>INSERT statement, incurring too many round trips.
>>
>>I want to convert this to the batch interface, i.e., addBatch() and
>>executeBatch(), but I read that this is implemented as multiple round
>>
> trips
>
>>anyway in 7.1.x and before. I also read that this might be fixed in 7.2,
>>
> but
>
>>I've been unable to verify this in the documentation.
>>
>>Can anyone enlighten me on the state of the batching interface? or is
>>
> there
>
>>some better way to do this?
>>
>>
>>Thank you,
>>Tony DeWitt
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>>
>>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>
>



pgsql-jdbc by date:

Previous
From: "Tony DeWitt"
Date:
Subject: Re: JDBC batching
Next
From: tony
Date:
Subject: tomcat 4 gurus