-----BEGIN PGP SIGNED MESSAGE-----
Patrick Duda wrote:
> I guess I don't understand this locking stuff. I have a InnoDB table
> that has one thing in it, a counter. All I want to do is have multiple
> instances of the code read this counter and increment it. I want to
> make sure that each one is unique.
> Here is what I am doing in java:
> rs = statement.executeQuery("select request_id from requestid_innodb for
> String updateQuery = "update requestid_innodb set request_id=";
> updateQuery = updateQuery + nextRequestId;
> tempStatement = c.createStatement();
> If I have multiple instances of this code running I end up with
> duplicate keys. I thought this was suppose to lock the table so that
> would not happen.
> What am I not doing right? What am I not understanding about locking?
Are you sure the table is using the InnoDB storage engine? What does the
output of "SHOW CREATE TABLE " for the table in question say?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----