Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

If I set the jdbc isolation level to read uncommitted in SQL Server, will SQL Server ever lock any tables, pages, rows etc?

Thanks.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Read uncommitted from Books Online:

Implements dirty read, or isolation level 0 locking, which means that no shared locks are issued and no exclusive locks are honored. When this option is set, it is possible to read uncommitted or dirty data; values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. This option has the same effect as setting NOLOCK on all tables in all SELECT statements in a transaction. This is the least restrictive of the four isolation levels.

So no it doesn't lock tables, rows or pages. However, any SELECT (even with READ UNCOMMITTED set) will issue a Sch-S (schema stability) lock, which basically means no schema changes can happen while the SELECT is executing (schema changes = add/drop column, change datatype of a column, change nullability of a column and a couple other operations I can't think of off the top of my head). A Sch-S lock should not interfere with DML statements (SELECT/INSERT/UPDATE/DELETE).

share|improve this answer
    
maybe add the link too? –  gbn May 9 '12 at 14:24
    
Good catch, done. –  Simon Righarts May 9 '12 at 21:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.