Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #54

Re: Getting a Mysql auto

From "Jim Garrison" <jim.garrison@THRWHITE.remove-dii-this>
Subject Re: Getting a Mysql auto
Message-ID <481bd982$0$12899$4c368faf@roadrunner.com> (permalink)
Newsgroups comp.lang.java.databases
References <be70739a-a825-45d5-9fb0-625bf0169050@k37g2000hsf.googlegroups.com>
Date 2011-04-27 15:21 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.databases
BoBi wrote:
> On Apr 20, 3:23 am, Arne Vajhoj <a...@vajhoej.dk> wrote:
>> Lew wrote:
>>> BoBi wrote:
>>>>   ResultSet rs = pstmt.getGeneratedKeys();
>>> If only you were using PostgreSQL, you could use their extension to the
>>> INSERT command:
>>>   [ RETURNING * | output_expression [ AS output_name ] [, ...] ]
>> But since we of course try to write database independent code, then
>> we will not use that even if our current database happen to
>> be PostgreSQL ...
>>
>> The getGeneratedKeys method is database independent - it just require
>> a JDBC 3.0 compliant driver.

Try comparing the Oracle and MSSQL implementations of this supposedly
"database independent" feature.  Oracle gets it right and supports
the API: you provide an array of column names in the PrepareStatement(), 
and Oracle returns their values for the newly inserted row.  MSSQL
throws a SQLException if the array contains more than one element, and
always returns the single "identity" column value regardless of the
column name you specified.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.databases | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Getting a Mysql auto "BoBi" <bobi@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
  Re: Getting a Mysql auto "Jim Garrison" <jim.garrison@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000
    Re: Getting a Mysql auto "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:21 +0000

csiph-web