Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Whats the best way to maintain consistency between two databases?

If i have two separate databases, and i am inserting in both databses and calling commit on both connections. if due to some problem lets say some network problem, second commit failed. how do we handle this? as the data is inserted in database1 but not in database2?

user-image
Question ajoutée par Ameer Pasha Md , Senior Software Analyst , intergraph
Date de publication: 2014/02/23
Ameer Pasha Md
par Ameer Pasha Md , Senior Software Analyst , intergraph

Hi John, 

thanks for you answer. But my situation is

 

Begintransaction1();

Begintransaction2();

 

Insert1();

Insert2();

 

commit1();

commit2();

 

if an exception occurs at commit2. then how shall we handle it? because the data in database1 got committed and cannot be rollbacked.and no data got inserted in database2, making the databases inconsistent

 

Nitya John
par Nitya John , Senior Systems Developer , American University of the Middle East

If inserting into both the databases are EQUALLY important, why dont you do commit after second insert.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?