Skip to Content.
Sympa Menu

freetds - Re: [freetds] issues connecting with perl DBD::ODBC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Kulik, Scott" <SKulik AT severstalna.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] issues connecting with perl DBD::ODBC
  • Date: Wed, 24 Jun 2009 09:53:37 -0400

Michael Higgins you are the man! I was able to export LD_BIND_NOW=1 and
the script ran with no problems the first time! I was also able to use
the DSN in my DBI connect statement:

my $dbh = DBI->connect('dbi:ODBC:PTT', 'user', 'pass', {PrintError =>
0});

However, like you mentioned...if I wanted to set the environment
variable in the perl code I had to put in a BEGIN block like the
following:

BEGIN {
$ENV{'PERL_DL_NONLAZY'} = 1;
}

This should probably be noted on the documentation pages since I assume
anyone running a similar linux such as redhat 3 will experience the same
issue.

Also, I did try removing the tabs from the odbc.ini but that didn't seem
to help. Thanks for the suggestion there though.

Thanks again everyone! I would have never figured that out by myself!

Scott K

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Michael Higgins
Sent: Wednesday, June 24, 2009 1:42 AM
To: freetds AT lists.ibiblio.org
Subject: Re: [freetds] issues connecting with perl DBD::ODBC

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
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page