473,594 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transaction across 2 databases?

Is it possible to wrap a transaction across 2 database? For example:

BEGIN TRANSACTION

.... alter something in Database_1

.... alter something in Database_2

COMMIT TRANSACTION
or if there is any error:
ROLLBACK TRANSACTION
Jul 23 '05 #1
3 8870
Robin Tucker (id************ *************@r eallyidont.com) writes:
Is it possible to wrap a transaction across 2 database? For example:

BEGIN TRANSACTION

.... alter something in Database_1

.... alter something in Database_2

COMMIT TRANSACTION
or if there is any error:
ROLLBACK TRANSACTION


Yes, just go ahead.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2
I don't know why but I was under the impression you couldn't do this! (Under
the impression for the past year while I've been developing my software
while looking nervously at the size of the crack between one database and
the other, through which partially completed operations might fall!). Well,
good news indeed.

"Erland Sommarskog" <es****@sommars kog.se> wrote in message
news:Xn******** *************@1 27.0.0.1...
Robin Tucker (id************ *************@r eallyidont.com) writes:
Is it possible to wrap a transaction across 2 database? For example:

BEGIN TRANSACTION

.... alter something in Database_1

.... alter something in Database_2

COMMIT TRANSACTION
or if there is any error:
ROLLBACK TRANSACTION


Yes, just go ahead.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Jul 23 '05 #3
Robin,

Transaction is a server wide concept rather than database wise. It is
perfectly valid to have cross database transaction. As a matter of fact,
one can even condutc cross server/apps distributed transaction using MSDTC
(BEGIN DISTRIBUTED TRAN).

--
Gang He
Software Design Engineer
Microsoft SQL Server Storage Engine

This posting is provided "AS IS" with no warranties, and confers no rights.
"Robin Tucker" <id************ *************@r eallyidont.com> wrote in
message news:cs******** ***********@new s.demon.co.uk.. .
Is it possible to wrap a transaction across 2 database? For example:

BEGIN TRANSACTION

.... alter something in Database_1

.... alter something in Database_2

COMMIT TRANSACTION
or if there is any error:
ROLLBACK TRANSACTION

Jul 23 '05 #4

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

Similar topics

16
7483
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I have an series of interactive HTML forms. The user begins a Cookie session. A database connection is opened and a transaction is begun. After the user goes through any number of pages where they update the database they finish on a page where...
3
4136
by: Evelyn Pabón | last post by:
Hi I created a database application for the company I'm working and as part of the CFR Part 11 it is a requirement for al the application that are for manufacturing us to have some security option like employee account to log on in the database and a transaction log to register al the activities that has occurred and saved with the employees name who made the transaction or the changes. But I don't have an idea on how to create this...
5
18310
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) Status MY_eems 368.49219 16.034182 0 I made a complete backup of the database and transaction log and then executed this statement: DBCC SHRINKFILE (MYeems_log, 1)
1
439
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? I have read the doc regarding this: http://www.developer.com/net/asp/article.php/3385631 but it will not work when methods are in different services on
5
3327
by: Klemens | last post by:
I get SQL30090 reason 18 by trying to do an insert in a federated table and an update in a local table in one transaction Do I have to change some settings to get done or ist this not possible by definition? Thanks Klemens
6
2121
by: Damon Grieves | last post by:
Hi I just want to be sure I understand how the Access client works. If I have an Access back end with a million records on a server and an Access client. If the client is installed on the users pc and run by the user...does Access drag the whole million records across the LAN when we call up one record ie filters for that record locally? If the client is on the same server as the back end, and the user starts up the client on the server...
2
3783
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 directory,
3
2096
by: peterc | last post by:
I have an existing database with approx 500,000 rows and accessed by a few hundred users per day creating approx 1,000 new records per day plus typical reporting - relatively low volume stuff for SQL Server. I'm about to add a process that will be importing data daily from legacy databases and summarizing it for reporting purposes, integrating it with the existing database. This volume of data will be considerably higher, perhaps...
19
4026
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! I'm using DB2 database on one server and ORACLE database on the second one. I want to move some data from ORACLE database to DB2 database and update some columns on ORACLE database so I know what rows were transfered. I'd like to do this in a distributed XA transaction and Java. :) How is this possible ? Best regards, Kovi
0
7874
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8246
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6652
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3854
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.