This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Second thread is blocked until the first thread commit the transaction, I can not understand why... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Second thread is blocked until the first thread commit the transaction, I can not understand why..." Watch "Second thread is blocked until the first thread commit the transaction, I can not understand why..." New topic
Author

Second thread is blocked until the first thread commit the transaction, I can not understand why...

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
I am learning transaction and isolation levels. I tried to use read_committed in one thread and then in another thread insert some data into a table. the reader thread is blocked and waits until the first thread commit the transaction to complete the select statement. What I can not understand is: shouldn't the second thread only read what is already committed instead of waiting until the inserting thread finishes its job?

Inserted thread code:



reader thread code:


also I tried and execute these code in two different application and the result is the same. The reader application waits for almost 20 seconds before it read the data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Second thread is blocked until the first thread commit the transaction, I can not understand why...
 
It's not a secret anymore!