gBay
September 3, 2010, 4:24pm
1
Hi all,
Im trying to connect to an Access database using PHP on an apache server but am getting nowhere. I get the following error:
odbc_connect() [<a
href=‘function.odbc-connect’>function.odbc-connect</a>]: SQL error:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /secure/h/mydomain.co.uk/includes/functions.php on line 9
my code is:
$dbq = realpath("database/boss.mdb");
$db_connection= odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbq", "ADODB.Connection","SQL_CUR_USE_ODBC");
$result = odbc_exec($db_connection, "SELECT * FROM tbPages WHERE pageName = 'home'");
Any ideas? thanks.
gBay
September 4, 2010, 12:52pm
2
Hmmm, Ive just run phpinfo() and it suggests it is. It says - PDO drivers: dblib, mysql, odbc, sqlite. Does that mean it is enabled?
Is there an alternative to connecting to Access (on Apache)?
felgall
September 4, 2010, 12:44am
3
gBay:
Hi all,
Im trying to connect to an Access database using PHP on an apache server but am getting nowhere. I get the following error:
odbc_connect() [<a
href=‘function.odbc-connect’>function.odbc-connect</a>]: SQL error:
[unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /secure/h/mydomain.co.uk/includes/functions.php on line 9
my code is:
$dbq = realpath("database/boss.mdb");
$db_connection= odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbq", "ADODB.Connection","SQL_CUR_USE_ODBC");
$result = odbc_exec($db_connection, "SELECT * FROM tbPages WHERE pageName = 'home'");
Any ideas? thanks.
Do you have ODBC installed on Apache?
Doug_G
September 4, 2010, 12:16am
4
I think access db’s need to reside on a windows computer, but I’m not 100% sure.