Thursday, March 29, 2012

Embedding isolation level in SQL OLE DB connection string?

Is there any way to embed the desired connection isolation level in a SQL
OLE DB connection string? I saw that the property "Isolation Level" exists
on SQL OLE DB connections but couldn't find a way to get this into the
connection string (extended property didn't work)
For 3rd party products that take connection strings and SQL queries and run
with them, it would be handy to be able to control the isolation level in
the connection string. I can do it at the SQL level, but I want the
isolation level to be configurable and not have to parse out/re-write the
SQL based upon the configured isolation level.
Thanks,
Mike
Mike Jansen wrote:
> Is there any way to embed the desired connection isolation level in a
> SQL OLE DB connection string? I saw that the property "Isolation
> Level" exists on SQL OLE DB connections but couldn't find a way to
> get this into the connection string (extended property didn't work)
> For 3rd party products that take connection strings and SQL queries
> and run with them, it would be handy to be able to control the
> isolation level in the connection string. I can do it at the SQL
> level, but I want the isolation level to be configurable and not have
> to parse out/re-write the SQL based upon the configured isolation
> level.
> Thanks,
> Mike
You can change the isolation level from the default of READ COMMITTED to
any of the other supported levels by issuing a single SQL statement
after you connect and it will stay in effect for the life of the
connection.
SET TRANSACTION ISOLATION LEVEL
{ READ COMMITTED
| READ UNCOMMITTED
| REPEATABLE READ
| SERIALIZABLE
}
David Gugick - SQL Server MVP
Quest Software

No comments:

Post a Comment