Easysoft ODBC-ODBC Bridge
Why do I get "SQLSetConnectOption err=-2" errors in my Perl scripts
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.
- If you are using Perl directly from the shell
Did the make test work when building DBD::ODBC? The DBD::ODBC make test sets PERL_DL_NONLAZY to 1 so if LAZY linking is the problem you don't see it in the DBD::ODBC test but can see it later when running your own scripts.
Try running your perl script again with the environment variable PERL_DL_NONLAZY set to 1.
If this cures the problem then you probably have a unixODBC which sets the RTLD_GROUP flag to dlopen.
If you are using the unixODBC driver manager distributed with OOB please let us know the name of your OOB distribution file and we will correct. If you are using unixODBC newer than 2.2.6 can rebuild unixODBC with the configure option --enable-rtldgroup=no. If you are using unixODBC 2.2.5 or earlier then you need to stop unixODBC using the RTLD_GROUP flag in libltdl/ltdl.c.
Edit libltdl/ltdl.c in the unixODBC source tree, look for a dlopen call using RTLD_GLOBAL which is ORed with LT_LAZY_OR_NOW and delete the "LT_GLOBAL |"
lt_module module = dlopen (filename, LT_GLOBAL | LT_LAZY_OR_NOW);
lt_module module = dlopen (filename, LT_LAZY_OR_NOW);
- If you are using Perl as CGI under Apache without mod_perl
SetEnv PERL_DL_NONLAZY 1
to the httpd.conf and restart Apache. Then follow instructions under a).
- If you are using mod_perl under Apache
Set the environment variable PERL_DL_NONLAZY to 1, export it and then stop/start Apache.
If this cures the problem then you need to add PERL_DL_NONLAZY=1 and export PERL_DL_NONLAZY to your apachectl startup program.
If it does not cure the problem and you are using a unixODBC newer than 2.2.6, you need to rebuild unixODBC with the configure option --enable-rtldgroup=no.
Easysoft build unixODBC with the following configure options:
--enable-threads=no (or yes when building a thread-safe version)
--enable-gui=yes (or no if you don't have X and QT)
--enable-rtldgroup=yes needs to be added to unixODBC 2.2.6, 2.2.7, 2.2.8 when unixODBC is dlopened by an application.
We also use --enable-readline=no on some platforms because our base build boxes are older and many newer machines don't have the older libreadline.
- Easysoft ODBC-ODBC Bridge
Knowledge Base Feedback