Roger Baklund wrote:

LAST_INSERT_ID() is connection specific, so it is safe from the
concurrency issue.

Note: "safe" may not apply if you're using connection pooling :-)

In what situation is this unsafe? In general, you would not call LAST_INSERT_ID() without first having done an INSERT in the same session, and even with connection pooling you would usually use the same connection for all statements related to a session. What am I missing?

Maybe I don't understand connection pooling, then. Isn't its purpose to allow a client -- say, a webapp running in Tomcat -- to multiplex requests for *multiple* end users over a single connection?

If so, how would LAST_INSERT_ID() be able to guarantee that another
end user's INSERT hadn't preceded it? Or am I totally OTL?  :-)

--
Hassan Schroeder ----------------------------- [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

dream. code.




-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to