need help with connecting to Access database
Posted: Fri Jun 02, 2006 7:17 am
Hello,
I am new to php and I am having problems connecting to my Access database. The database is in the folder:
C:\inetpub\wwwroot folder.
I created a odbc connection. My database is called Accord and the connection is called Accord as well. I used it as a system database.
My php code looks like this:
At first I tried using the $db connection with Microsoft.Jet and I got the error "Cannot open with Jet".
Then I tried the $db with the .mdb driver and got the error "Cannot open with driver"
Then I tried using the obdc connection (that's why it is not commented out) and I am getting an error which states:
Warning: odbc_connect() [function.odbc-connect]: SQL error: , SQL state 00000 in SQLConnect in c:\Inetpub\wwwroot\accord\info.php on line 90. Line 90 being this line:
$connect = odbc_connect("Accord", "", "");
So can someone help me to connect to my Access database. I have been doing research on this, but can't seem to get it to work.
Any help would be appreciated.
I am new to php and I am having problems connecting to my Access database. The database is in the folder:
C:\inetpub\wwwroot folder.
I created a odbc connection. My database is called Accord and the connection is called Accord as well. I used it as a system database.
My php code looks like this:
Code: Select all
//$db = 'C:\\Inetpub\\wwwroot\\Accord.mdb';
//$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
//$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.');
//$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or exit('Cannot open with driver.');
$connect = odbc_connect("Accord", "", "");Then I tried the $db with the .mdb driver and got the error "Cannot open with driver"
Then I tried using the obdc connection (that's why it is not commented out) and I am getting an error which states:
Warning: odbc_connect() [function.odbc-connect]: SQL error: , SQL state 00000 in SQLConnect in c:\Inetpub\wwwroot\accord\info.php on line 90. Line 90 being this line:
$connect = odbc_connect("Accord", "", "");
So can someone help me to connect to my Access database. I have been doing research on this, but can't seem to get it to work.
Any help would be appreciated.