#128 _connect function in adodb-odbc.inc.php fails in Linux

v1.0 (example)
open
nobody
None
5
2014-02-24
2013-08-29
Willy Lee
No

The _connect function errors with

PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/wlee-moodle/lib/adodb/drivers/adodb-odbc.inc.php on line 64

when the the connect function passes a dsn and database name. Previous to version 5.17, this worked fine. It looks like the logic that tries to create a dsn less connection fails on my system because it doesn't know what driver to use. Sending the exact same call to pconnect works as it used to.

If I strip out the stuff around line 55 that tries to append the database name to the dsn, it works again.

PHP 5.3.3 on RedHat 6

We're using this inside of Moodle, but I could see how this might trip up other software that calls that function.

Discussion

  • dregad
    dregad
    2014-02-24

    Can you provide detailed info on how you actually call _connect() including the values of the parameters ?

    Sending the exact same call to pconnect works as it used to.

    Looks like the patch which was made in _connect() was not applied to _pconnect() which is probably an oversight, and explains the behavior.