[unixODBC-support] RH9.0 PHP-4.2.2 Not recognize DSN

Ian Lai ianlai at elait.com
Fri Dec 31 06:19:51 GMT 2004


Hi,
Hope somebody can help. Thanks in advance.

I'm using MDBTools trying to link to MSAccess MDB file in the same Linux
box.

PHP>> Warning: SQL error: [unixODBC][Driver Manager]Data source name not
found, and no default driver specified, SQL state IM002 in SQLConnect in
/var/www/html/mdb.php on line 8

mdb.php

<?php
putenv("LD_LIBRARY_PATH=/usr/lib");
putenv("ODBCINSTINI=/etc");
putenv("ODBCINI=/etc");
$DB = "/var/www/html/mdb/pcsexports.mdb";
$Srv = "localhost";
$dsn = "PCS";
$mdb = odbc_connect ( $dsn,"","" );

echo phpinfo();
?>

/etc/odbc.ini
[PCS]
Description		= MDB
Driver		= MDB
Database		= /var/www/html/mdb/pcsexp.mdb
Servername		= localhost
Username		=
Password		=

/etc/odbcinst.ini
[PHP-ODBC]
Description		=
Driver		= /usr/lib/php4/odbc.so
Setup		= /usr/lib/php4/
FileUsage		= 1
CPTimeout		=
CPReuse		=

[MDB]
Description		=
Driver		= /usr/lib/libmdbodbc.0
Setup		= /usr/lib/libmdbodbc.0.0.0
FileUsage		= 1
CPTimeout		=
CPReuse		=


/etc/php.d/odbc.ini
extension=odbc.so

When I run
#isql -v PCS
It says connected.

I noticed in my file /etc/php.ini, there is a section
[ODBC]
;odbc.default_db    =  PCS
;odbc.default_user  =
;odbc.default_pw    =
I'm not sure does it matter.


Thanks,

Ian Lai





More information about the unixODBC-support mailing list