Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi can any one tell me how can i get last inserted id using jsp and mysql...?
Posted
Comments
Sandeep Mewara 30-Aug-12 9:09am    
Using a query?

Tried anything?
Khudha Bakhsh Mari 30-Aug-12 9:23am    
mysql_insert_id this is in php is there like this in jsp ...?

1 solution

Hi,
Try changing your execute query:
Java
numero = stmt.executeUpdate(query);

to:
Java
numero = stmt.executeUpdate(query, Statement.RETURN_GENERATED_KEYS);


Refer the links below:
http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html[^]


--Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900