I have this JDBC code where I need to insert a record and then get the id of that inserted column. Everything works fine until I run a threaded test that tries to do 10 of these at once. The problem is that everything seems to run OK. The log prints out the id. But when I query the database only the last record was inserted. All the others are not persisted. No exceptions are thrown.
So for each call two queries are being run. Even though these are being run in different threads, only the last one works. If I run them sequentially, not in threads, it all works.
The problem really being I am running this in a threaded environment in production...
The squeaky wheel gets the grease. Well, that or replaced...
Joined: May 26, 2005
Arg. You work on something all morning and then finally post in desperation, only to figure it out 10 minutes later... I should have posted hours ago. Then I would have figured it out hours ago + 10 minutes...
The SQL for the identity select was incorrect. I was using this which is wrong:
This is wrong, wrong, wrong. And needless to say caused me heartburn. Here is the correct SQL.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com