Below is my sequence of code
// global autocommit is 1
db->query('SET AUTOCOMMIT=0');
db->query('BEGIN');
db->query('INSERT INTO TRANSACTIONS (CREDIT) VALUES (150)');
db->chagngeDatabase('member');
// here autocommit become 1 automatically after Db change. And the previous query rollback automatically
db->query('INSERT INTO memberAccount(CREDIT) VALUES (150)');
db->query('COMMIT');
Whenever i'm trying to change the database then the autocommit value becomes 1 and its rollback my previous query. How to do transactions while changing the db between queries in same server?
I have checked XA Distributed transactions, But it is mentioned for Transaction between different servers. here i need in a same server