I have used it in the past, it works fine for me but you have to be aware
that it is per Db session and if you are using connection pooling you may
get the wrong last statement.  I solved the problem by putting my id into a
bean, and then using that as for the where for my updates.

Statement get_last_insert = con.createStatement();
String q = "select last_insert_id();"
ResultSet rs = con.executeQuery(q);


Jesse Schoch

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Holmes, George
(TWIi London)
Sent: Friday, October 06, 2000 9:52 AM
To: Orion-Interest
Subject: MySQL Identity Columns


Hi,

Does anyone have any code fragments for retrieving a MySQL identity value
using getLastInsertID() [ org.gjt.mm.mysql drivers ] under Orion?  The
documentation says that you have to cast the bespoke
statement/preparedstatement to a java.sql statement/preparedstatement?
Every time I get a ClassCastException?

Any help would be greatly appreciated.

Thanks

George

GEORGE HOLMES

TWI Interactive
Media House
Burlington Lane
LONDON
W4 2TH
ENGLAND

TEL: +44 208 233 5631
FAX: +44 208 233 7701
CELL: +44 7968 918813




Reply via email to