java - statement.getGeneratedKeys() and MySQL -
i've learned hard way last_insert_id in mysql not pool-safe. i.e. if pooling connections, you'll messed insert_ids. how java's statement.getgeneratedkeys() key on inserts? pool-safe?
i quoting relevant text mysql connector/j internals here:
you should aware, @ times, can tricky use 'select last_insert_id()' query, function's value scoped connection. so, if other query happens on same connection, value overwritten. on other hand, 'getgeneratedkeys()' method scoped statement instance, can used if other queries happen on same connection, not on same statement instance.
Comments
Post a Comment