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


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

Re: Getting a Mysql auto

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Jim Garrison" <jim.garrison@THRWHITE.remove-dii-this>
Subject Re: Getting a Mysql auto
Message-ID <481bd982$0$12899$4c368faf@roadrunner.com> (permalink)
X-Comment-To comp.lang.java.databases
Newsgroups comp.lang.java.databases
In-Reply-To <be70739a-a825-45d5-9fb0-625bf0169050@k37g2000hsf.googlegroups.com>
References <be70739a-a825-45d5-9fb0-625bf0169050@k37g2000hsf.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 28
Date Wed, 27 Apr 2011 15:21:29 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917689 96.60.20.240 (Wed, 27 Apr 2011 10:21:29 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:21:29 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:54

Show key headers only | 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