At 08:47 AM 3/27/2005 -0700, Brandon Goodin wrote:
I don't think you need to worry about LAST_INSERT_ID so long as you
have the same connection that inserted it. With IBatis this is not a
problem.

"The last ID that was generated is maintained in the server on a
per-connection basis. This means the value the function returns to a
given client is the most recent AUTO_INCREMENT value generated by that
client. The value cannot be affected by other clients, even if they
generate AUTO_INCREMENT values of their own. This behavior ensures
that you can retrieve your own ID without concern for the activity of
other clients, and without the need for locks or transactions."

The paragraph above assumes that the "client" always holds onto the same database connection. In the case where a framework (i.e. Spring) is managing the database connections, perhaps using commons-dbcp, wouldn't it be possible that it would grab a connection from the pool, execute the insert, then release it back to the pool?
John Fereira
[EMAIL PROTECTED]
Ithaca, NY





Reply via email to