在mysql 中是这样的:例如你刚进行插入语句:String sql = "insert into table values(...)";objConn.executeUpdate(sql);下面是取刚插入数据库的ID号long ret_id=0;ResultSet rs = objConn.executeQuery("select LAST_INSERT_ID()");if (rs.next())ret_id = rs.getLong(1);