473,473 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Transaction reading from Linked Server without DTC? (Isolation Level?)

Is there a way to read data from a linked server,
within a transaction, without using DTC?

The data on the linked server is static, therefore
there is no need for two-phase commit. There is
no need for locking data on the linked server, because
it is not being updated (either from the remote server,
or from the local server).

I don't want to run DTC because:
1.) there have been security-related flaws with DTC in
the past

2.) the application doesn't do distributed updates, and
because the data on on the remote server is static,
there is really no data integrity exposure without
DTC.

I cannot specify "WITH (NOLOCK)" on the select from
the linked server:
Server: Msg 7377, Level 16, State 1, Line 6
Cannot specify an index or locking hint for a remote data source.

I tried setting the isolation level:
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
but that seems to have no effect on the requirement to use DTC.

I still get the message:
MSDTC on server 'LOCALSERVER' is unavailable.

Is there some other way around this? Is it possible to provide some
connection string parameter, in the linked server setup, that would
specify the "READ UNCOMMITTED" isolation level for the linked server,
so that DTC wouldn't be necessary.

(In other words, can I tell SQL Server, "trust me, this won't hurt"?)

Environment: SQL Server 2000 sp4

The SQL does something like:

declare @x char(4), @k int, @rc1 int, @rc2 int
set @k=123
BEGIN TRAN
select @x=x
from remoteserver.remotedatabase.dbo.table
where k=@k
update localdatabase.dbo.table1
set x=@x
where k=@k
set @rc1=@@error
update localdatabase.dbo.table2
set x=@x
where k=@k
set @rc2=@@error
if (@rc1 = 0 AND @rc2=0) COMMIT TRAN
else ROLLBACK TRAN
Feb 9 '06 #1
2 7995
Larry Bertolini (be*********@osu.edu) writes:
Is there a way to read data from a linked server,
within a transaction, without using DTC?

The data on the linked server is static, therefore
there is no need for two-phase commit. There is
no need for locking data on the linked server, because
it is not being updated (either from the remote server,
or from the local server).
It's possible that if you set the remote database as read-only that
you will not need DTC. I have not tried this, though.
The SQL does something like:

declare @x char(4), @k int, @rc1 int, @rc2 int
set @k=123
BEGIN TRAN
select @x=x
from remoteserver.remotedatabase.dbo.table
where k=@k
update localdatabase.dbo.table1
set x=@x
where k=@k
set @rc1=@@error
update localdatabase.dbo.table2
set x=@x
where k=@k
set @rc2=@@error
if (@rc1 = 0 AND @rc2=0) COMMIT TRAN
else ROLLBACK TRAN


Well, the obvious thought when I see this code is: why not move
the SELECT on the remote query outside the transactions?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 9 '06 #2
Erland Sommarskog wrote:
It's possible that if you set the remote database as read-only that
you will not need DTC. I have not tried this, though.
I tried it, but it had no effect.

Well, the obvious thought when I see this code is: why not move
the SELECT on the remote query outside the transactions?


Well, sure. The code I provided was just some stuff I hacked up
as a "proof of concept", to see if setting an isolation level would
allow a remote select within a transaction, without DTC. The "real"
code belongs to a programmer in a different department, and I haven't
even seen it. I can only assume that it's inconvenient (though perhaps
necessary) to restructure the code so that the remote selects are
outside of the transaction(s).

Thanks for the help.
Larry

Feb 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: extmb | last post by:
Hi, I am quite puzzled how SQLServer manages transactions. Whatever the isolation level I set when performing an insertion, other connections do not have access to the table in select mode. ...
4
by: Leaf | last post by:
Greetings, I've been reading with interest the threads here on deadlocking, as I'm finding my formerly happy app in a production environment suddenly deadlocking left and right. It started...
3
by: Eric Porter | last post by:
Dear All, I have a VB6.COM program using a VB6.COM DLL, which in turn uses ADODB that performs various bits of SQL. I have re-written the VB6.COM DLL in C#.NET (with a VB6 shell), which uses...
3
by: Mike P | last post by:
I am using transactions on my website and the Isolation Level is ReadCommitted. Since the website has a lot of traffic this may be causing it to lock up every now and again. Can somebody tell...
2
by: kanda | last post by:
Hello. I am developing the application (VBA&ODBC, to be exact) which periodically calls the stored procedures in the IBM DB2. A few of the procedures require executing with isolation level RR (...
3
by: joshsackett | last post by:
I am redesigning an application that distributes heldesk tickets to our 50 engineers automatically. When the engineer logs into their window a stored procedure executes that searches through all...
2
by: Christian Stooker | last post by:
Part one: ====== Hi ! I want to use SQLite database like the FireBird database: with big isolation level. What's that meaning ? I have an application that periodically check some input...
3
by: D. | last post by:
I have a question about the "readCommitted" transaction isolation level. I have a client that is updating a record on a table. I suspend the execution after the UPDATE but before the commit...
5
by: dhek | last post by:
Hi, I have 1 SQL statement selecting data from various tables and updating other tables. The question then is how do I prevent other applications from modifying the tables that I'm working on...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.