Right - there isn't a portable way of doing this with JDBC. You can use a database-specific feature to acquire the info, but note that you'll need to do this inside a <sql:transaction> tag, since the "last OID"-type features are always connection-specific, and <sql:transaction> is currently the only way of ensuring that two successive database operations use the same connection.
-- Shawn Bayern "JSP Standard Tag Library" http://www.jstlbook.com (coming this summer from Manning Publications) On Wed, 1 May 2002, Henri Yandell wrote: > Very very unlikely. I don't think any drivers provide this yet. The JDBC > 3.0 spec does have such a thing, but it's new and not really common. > > Two Options: > > 1) Find some SQL that is mysql specific to find it out. I know there is > something, I'm just not sure what. I'll try to hunt it out. > > 2) Look at the mysql driver for some extra methods to do such a thing. I > know Oracle's driver has a bunch of extra things in, but I'm not sure if > Mysql does. I've never tried looking at the source to find extra non-spec > code. > > Hen > > On Wed, 1 May 2002, Carole E. Mah wrote: > > > > > Does anyone know if the JSTL database tags (<sql>) provide any method for > > retrieving the unique ID of the row that was inserted last (when you set > > up you mySQL database table to AUTO_INCREMENT the unique id). > > > > This is how I do it using PHP, which provides the mysql_insert_id() > > function for just this purpose: > > > > $query = "INSERT INTO foo (name, phone) VALUES ('Jane Doe','555-1212')"; > > $LINK = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD); > > $result = mysql_db_query ("$DB", $query); > > $my_id = mysql_insert_id($LINK); > > > > Thanks! > > > > -carole > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > Carole E. Mah [EMAIL PROTECTED] > > Senior Programmer/Analyst > > Brown University Scholarly Technology Group > > phn 401-863-2669 > > fax 401-863-9313 > > http://www.stg.brown.edu/ > > personal: http://www.stg.brown.edu/~carolem/ > > > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>