Easysoft ODBC-ODBC Bridge

Why do I get "SQLSetConnectOption err=-2" errors in my Perl scripts

Last Reviewed:
15th January 2024

When running a Perl script using DBD::ODBC linked with the unixODBC Driver Manager, you see something similar to this:

DBI->connect(test) failed: (Unable to fetch information about the error)
(DBD: dbd_db_login/SQLSetConnectOption err=-2) at perl_e1.pl line 9

We believe this is caused by the combination of lazy linking and RTLD_GROUP.

Easysoft build the unixODBC Driver Manager with the following configure options:

./configure --prefix=/usr/local/easysoft/unixODBC
--enable-threads=no (or yes when building a thread-safe version)
--enable-gui=yes (or no if you don't have X and QT)

To dlopen unixODBC in an application, --enable-rtldgroup=yes needs to be added to the unixODBC 2.2.6, 2.2.7, 2.2.8+ configure line.

We also use --enable-readline=no on some platforms, because many newer machines don't have the libreadline version that's present on our build machines (which are older, for backwards compatibility reasons).

Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)