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

Nick Gorham nick.gorham at easysoft.com
Fri Dec 31 08:44:55 GMT 2004


Ian Lai wrote:

>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
>
>  
>
You don;t need to putenv's they are telling unixODBC to try and open the 
directory as the ini files, either use

ODBCINSTINI=/etc/odbcinst.ini
ODBCINI=/etc/odbc.ini

or to point the location of the ini file

ODBCSYSINI=/etc

Or just nothing, unixODBC will look where its been built to look if 
these are not changed.

-- 
Nick

>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
>
>
>_______________________________________________
>unixODBC-support mailing list
>unixODBC-support at easysoft.com
>http://mail.easysoft.com/mailman/listinfo/unixodbc-support
>
>
>  
>




More information about the unixODBC-support mailing list