ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_multidatabase:connections

This is an old revision of the document!


Connecting to Multiple Databases

In this example we maintain connections to 2 databases at the same time. The transactional status of each database is managed independantly, but we can ensure that both databases remain synchronized by checking the transactional status of both connections before committing changes to both.

include 'adodb.inc.php';  # load code common to ADOdb

$conn1 = adoNewConnection('mysql');  # create a mysql connection
$conn2 = adoNewConnection('oracle');  # create a oracle connection

$conn1->connect($server, $userid, $password, $database);
$conn2->connect(false, $ora_userid, $ora_pwd, $oraname);
 
$conn1->Execute('insert ...');
$conn2->Execute('update ...');
v5/userguide/learn_multidatabase/connections.1458351049.txt.gz · Last modified: 2017/04/21 11:40 (external edit)