Page 1 of 1

reestablishing the database connection

Posted: Wed Nov 15, 2006 8:15 am
by ryuuka
back again

connection is made in the index.php file and each internal link in the site is opened
in a cell of that window.
now i need to make a connection to a different database while in the same site.

how do i establish a connection to the new database for this particular part of the page
while retaining the connection defined in the index.php

the connection in the index.php needs to be maintained because the link information
and the layout for the site is recorded in the first database.

i already tried closing the connection on top of the page and reopening it on the bottom
didn't work :(

connections:
new connection:

Code: Select all

$objConn = new COM("adodb.connection");
$objConn->Open("dsn=@@@_Inventory;server=sr0005.@@@.net;database=ePO_SR0005;Trusted_Connection=yes");
essential connection:

Code: Select all

$db = new COM("ADODB.Connection") or die("Kan ADO niet starten");
$db->Open("dsn=@@@_Inventory;server=sr0005.@@@.net;database=@@@_ICT;Trusted_Connection=yes");
any suggestions on how i might go about doing this

Posted: Wed Nov 15, 2006 2:59 pm
by feyd
Isn't ADODB an ODBC database?

ADOdb supports ADODB, I believe.

http://adodb.sf.net

Posted: Wed Nov 15, 2006 7:51 pm
by RobertGonzalez
What error messages are you getting? This should work exactly how you have it, provided the DSN's are correct and the Open method is working properly.

Posted: Thu Nov 16, 2006 1:17 am
by ryuuka
feyd:
Isn't ADODB an ODBC database?

ADOdb supports ADODB, I believe.
what do you mean by this exactly?

Everah

that is the problem i don't get an error.
And with a connection outside the website it shows
everything i need.

Nothing shows up, not even with this:

Code: Select all

error_reporting(E_ALL); 
ini_set('display_errors', TRUE);
that's mainly the problem[/quote]

Posted: Thu Nov 16, 2006 6:51 am
by feyd
Well, if ADODB supports ODBC requests, you could use the ODBC connector functionality that PHP has.

http://php.net/ref.uodbc .. As an alternate, you could use the ADOdb library, which I've already linked to above.

Posted: Thu Nov 16, 2006 10:27 am
by RobertGonzalez
How are you error checking? You should be error checking at least twice when connecting... once when hitting the server, once when selecting a database.