Well, you should be able to do SELECT LAST_INSERT_ID() right after your INSERT statement. Depending on your JDBC driver version you might be able to use the public int executeUpdate(String SQL, int autoGeneratedKeys) method. This only works with JDBC 3.0 specifications though. If you aren't already, I highly recomend using the Connector-J Driver. Good luck.