Friday, June 25, 2010

Pear MDB2 - Multiple DB Connections

So recently I needed to connect to separate DB's simultaneously using PEAR MDB2. 
There are 2 tricks to this.  I needed to keep both connections alive and make queries and inserts to both.  Using factory() alone will still not keep the dbname's seperate.  My connections looked good but on executing a query I would return an error "Table Does Not Exist"


The other trick to this is in your dsn.  Use 'new_link' => true
http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php



I hope this helps.



Brian J. has been involved in web design since 1997. He is the founder of True Vision Computer Services, Inc. His recent focus has been on web applications and information systems development.

No comments: