Is it possible to open connections to two schemas on the same server using PHP 5.3/ADODB5/SQL Server 2008? Here's what I'm trying:
// Connect to users database
$connUsers = NewADOConnection('mssql');
$connUsers-> Connect($server, $user, $password, $dbNameUsers);
$connUsers->SetFetchMode(ADODB_FETCH_ASSOC);
// Connect to main database
$conn = NewADOConnection('mssql');
$conn-> Connect($server, $user, $password, $dbNameMain);
$conn->SetFetchMode(ADODB_FETCH_ASSOC);
Either one works alone, but queries fail if both are open at the same time. Note that everything is the same except the database name.
A couple of places I looked said that you can omit the server name in the second connection string, like this:
$conn-> Connect(false, $user, $password, $dbNameMain);
But this gave me errors (recordsets opened against the $conn are not valid objects).
I can open and close different connections as I need them, but for maintainability I'd sure like to set all my connections at the top of my scripts and then close them all at the bottom.
Thanks for any help.