[freetds] issues connecting with perl DBD::ODBC
Michael Higgins
linux at evolone.org
Wed Jun 24 01:41:58 EDT 2009
On Tue, 23 Jun 2009 17:59:16 -0400
"Kulik, Scott" <SKulik at severstalna.com> wrote:
> If I try to use a format similar to:
>
> my
> $DSN="Driver=FreeTDS;Server=localhost;ServerName=TREX;Port=1799;Database
> =TREX;UID=_user;PWD=_pass";
> my $dbh = DBI->connect("dbi:ODBC:$DSN",'_user','_pass');
>
> like mentioned in the last response I always get a segmentation fault.
Sorry, I missed that.
Anyway, you may want to try doing this same kind of connect, but with one of, however you want to set it:
export LD_BIND_NOW=1
or
export PERL_DL_NONLAZY=1
... which works with DBI if I just set %ENV in a BEGIN block. This didn't work with DBIx-Class (though LD_BIND_NOW did if set outside the script).
If that makes a difference to the segfault (it does for me), then I think maybe you can connect in any way. IOW, I think the problem, whatever it is, is what causes the segfault. It is just a different result of the same underlying problem, but things are in fact handled differently depending on what is in the connect string.
I think there's some SQL_ERROR library that isn't available at connect, but perhaps could be. When the library is preloaded, then you get normal error responses, which prompts the right behaviour, a second attempt at a SQL connect. This is mostly a guess, though, inferred from reading.
Finally, I just put /usr/lib/libtdsodbc.so in /etc/ld.so.preload ... which may, or may not be right, or right for your distro, but hopefully you see the point. I think there is something wrong in the library linking from unixODBC to FreeTDS when called with DBD::ODBC. I know squat about it... though I can say this above is what works for me.
Good luck!
--
|\ /| | | ~ ~
| \/ | |---| `|` ?
| |ichael | |iggins \^ /
michael.higgins[at]evolone[dot]org
More information about the FreeTDS
mailing list