What is the default transaction isolation level for SQL Server with ADO.NET?

Go To StackoverFlow.com

42

What is the default transaction isolation level for SQL Server with ADO.NET? I am using a default installation of SQL Server and just the normal System.Data.SqlClient classes.

2012-04-03 23:40
by Jonathan Allen
If you downvote, please explain wh - Remus Rusanu 2012-04-04 00:17
@RemusRusanu: Not reading the docs first I guess. (I did not downvote - Neolisk 2013-11-05 15:06
@Neolisk: Things are often more complex than they seem... http://stackoverflow.com/questions/9851415/sql-server-isolation-level-leaks-across-pooled-connection - Remus Rusanu 2013-11-05 15:11
Just curious about the fragment of your question which specifically mentions with ADO.NET? I believe irrespective of the provider w.r.t. the client side programming world (Java, .Net, Python etc) the default is driven by the database engine and NOT the provider. So the default isolation level for SQL Server should remain same irrespective of whether you are using ADO.NET or any other client side provider to connect to a SQL Server database. Kindly correct me if I'm wrong - RBT 2016-08-24 02:46
For other settings, there are differences between the defaults for ADO.NET and SQL Server Management Studio. So that's not really a safe assumption - Jonathan Allen 2016-08-25 09:06


56

READ COMMITTED is the default isolation level for the Microsoft SQL Server Database Engine.

Source:

Here is how it compares to other isolation levels:

The MSDN documentation for SqlConnection.BeginTransaction() also states Read committed

... To reset the isolation level to the default (READ COMMITTED) ...

2012-04-03 23:44
by hkf


10

By default, the isolation level for TransactionScope is Serializable which provides the highest level of protection.

See below link for more information:

2013-11-21 17:25
by user2818985
This answer seems more relevant because it's about .NET transactions, not when using TSQL - James McLachlan 2014-01-15 19:30
The question relates to ADO NET which offers tools for database access from System.Data namespace (where by the way default isolation level is set to ReadCommitted). Whilst TransactionScope comes from System.Transactions namespace, which offers these tools over data source in general (e.g. web service) - Bronek 2015-04-14 11:27
I just downvoted it because when in .NET you call System.Data.SqlClient.SqlConnection.BeginTransaction() the resulting Transaction has isolation level ReadCommited, as hkf describes - mischka 2017-01-12 14:35