Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: Getting a M...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 8 Topic 3680 of 3800
Post > Topic >>

Re: Getting a Mysql auto increment value back into my Java client

by Jim Garrison <jhg@[EMAIL PROTECTED] > May 2, 2008 at 10:18 PM

BoBi wrote:
> On Apr 20, 3:23 am, Arne Vajhøj <a...@[EMAIL PROTECTED]
> 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 sup****ts
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.
 




 8 Posts in Topic:
Getting a Mysql auto increment value back into my Java client GU
BoBi <1kdg@[EMAIL PROT  2008-03-19 11:33:33 
Re: Getting a Mysql auto increment value back into my Java clien
David Harper <devnull@  2008-03-19 21:20:24 
Re: Getting a Mysql auto increment value back into my Java clien
Lew <lew@[EMAIL PROTEC  2008-03-19 19:55:53 
Re: Getting a Mysql auto increment value back into my Java clien
=?UTF-8?B?QXJuZSBWYWpow7h  2008-04-19 21:23:38 
Re: Getting a Mysql auto increment value back into my Java clien
BoBi <1kdg@[EMAIL PROT  2008-03-21 00:40:11 
Re: Getting a Mysql auto increment value back into my Java clien
BoBi <1kdg@[EMAIL PROT  2008-05-02 01:59:19 
Re: Getting a Mysql auto increment value back into my Java clien
Jim Garrison <jhg@[EMA  2008-05-02 22:18:26 
Re: Getting a Mysql auto increment value back into my Java clien
=?ISO-8859-1?Q?Arne_Vajh=  2008-05-14 21:19:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:54:41 CDT 2008.