Hello. I'm wondering if anyone here would like to elighten me on how to use the getLastInsertId() function in the mm.mysql jdbc driver?? I know it's an offtopic question but if you can help, please do so. I need to retrieve the auto_increment id of the last row created in a table. Since there may be concurrent writes to the same table, I cannot do a "select max(id)" to get it. I need to use the method in mm.mysql. Only problem is, I just don't know how to use it. Quoting m.matthews (mm.mysql authour): -------------------------------------- With my driver, MM.MySQL available at http://www.worldserver.com/mm.mysql/ you can call get the id`s of AUTO_INCREMENT inserts by casting your java.sql.Statement/PreparedStatement to org.gjt.mm.mysql.Statement/PreparedStatement and calling getLastInsertID() on it. -------------------------------------- Now, how do I use this from the following code snippet? my code: -------------------------------------- public void createSite(String a, String b, String c) { try{ // guess I need to cast this some other way, but how? Statement stmt = dbConnection.createStatement(); int count = stmt.executeUpdate("INSERT INTO ..."); // here i need to catch the ID that was just created // in the auto_increment field.. } catch (SQLException e) { log(e.getMessage()); } } Regards, Christopher Cato --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
