In SQL server if the program is updating a row and at the same time if a program is trying to read that particular row which is being updated then what happens assuming that the transaction level is set to read_committed. Will there be a lock and the thread try to read that row will wait till the lock is released or will it read the previous data of the row and display it to the user? What happens if the transaction is set to read_uncommitted?
Similarly what happens if 2 threads are trying to update the same row at the same time?
posted 11 years ago
Well, it will depend on your database implementation but..
I believe 'read commited' usually means 'Show me only rows who's changes have been committed to the database'
So, if you try a read a row whilst a write is taking place, you will see the data prior to the write, until the row change is committed.
But really, you don't want JDBC's semantics for this, you want the underlying db's implementation of how it works.