Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 767C91337C14 for ; Tue, 8 Mar 2011 10:55:21 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 84797-05 for ; Tue, 8 Mar 2011 14:55:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by mail.postgresql.org (Postfix) with SMTP id 4CDDD1337BEB for ; Tue, 8 Mar 2011 10:55:06 -0400 (AST) Received: (qmail 20673 invoked by uid 0); 8 Mar 2011 14:55:05 -0000 Received: from 217.91.105.163 by www159.gmx.net with HTTP; Tue, 08 Mar 2011 15:55:03 +0100 (CET) Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset="utf-8" Date: Tue, 08 Mar 2011 15:55:03 +0100 From: "hans wulf" In-Reply-To: Message-ID: <20110308145503.204100@gmx.net> MIME-Version: 1.0 References: <20110308141705.13350@gmx.net> Subject: Re: PreparedStatement batch statement impossible To: Dave Cramer X-Authenticated: #18544190 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+0Eks8Et20nuZn9kpe8JnhpG+EI+B3bn7DejIOLw eQNvdftNtv5SCtDqBYI/uhDZPBGA4goYT5Yw== Content-Transfer-Encoding: 8bit X-GMX-UID: JioDfo56ODB6QlSXaWVMVlg9Ji9SWtLE X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.356 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/9 X-Sequence-Number: 21564 Hi Dave, thanks for the quick reply. without executeBatch the whole JDBC driver is worthless, we don't need a discussion on that :-) Without being able to get the generatedKeys from an Batch, it is impossible to insert into multiple tables vendor-independently. Mysql manages this without any problems. This should be the way to go for the future. I don't thing I have to tell the story of my ugly code: if (MYSQL) doThePropperAPIStuff() else if (POSTGRES) { 1. generate a bulk of future keys 2. pass out these future keys to all entries }else if (ORACLE){ 1. do more a less the same as in POSTGRES but with different Syntax } I don't think that sort of code was the intension of JDBC... -------- Original-Nachricht -------- > Datum: Tue, 8 Mar 2011 09:27:44 -0500 > Von: Dave Cramer > An: hans wulf > CC: pgsql-jdbc@postgresql.org > Betreff: Re: PreparedStatement batch statement impossible > Hans, > > It's certainly not clear that this is a requirement of the API. Even > executeBatch is an optional requirement. > > Does anyone have any clear direction on how to handle this ? It would > appear that even oracle's jdbc throws an error. > > Dave > > On Tue, Mar 8, 2011 at 9:17 AM, hans wulf wrote: > > hi, > > > > the API says you can use getGeneratedKeys() after executing the > statements. But executeBatch() fails... > > > > The driver has got a problem here: > > > > The normal way would be: > > > > 1. Create a PreparedStatement with the GET_GENERATED_KEYS flag > > 2. executeBatch without Exception > > 3. call getGeneratedKeys() > > > > > > -- > > GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit > > gratis Handy-Flat! http://portal.gmx.net/de/go/dsl > > -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl