ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Ameer Pasha Md , Senior Software Analyst , intergraph
تاريخ النشر: 2014/02/23
Ameer Pasha Md
من قبل 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
من قبل Nitya John , System Analyst , The American University of Kuwait

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

المزيد من الأسئلة المماثلة