Re: issues connecting with perl DBD::ODBC

Per Stenebo <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I'm a beginner of FreeTDS but an associate reported that tab spaces in
config files (odbc.ini in particular) could lead to troubles, try reduce to
single spaces before and after the <=>-sign.

Maybe a long shot, but it would be nice to know if tab spaces really are a
problem or not.
/ Per Stenebo

2009/6/23 Kulik, Scott <[email protected]>

> Wow...this is really frustrating.  I thought this would be the easiest
> step.  I double checked the messages logs which didn't have any errors
> and SELinux is already off.
>
> I attempted to redo my configuration based on the config files below.  I
> can even setup an ODBC only config without using freetds.conf but I'm
> still having the same issue. (even though I can connect and query using
> isql no problem)
>
> For some reason if I specify my $dbh like the following:
>
> my $dbh = DBI->connect('dbi:ODBC:PTT', user', 'pass', {PrintError =>
> 0});
>
> die "Unable for connect to server $DBI::errstr" unless $dbh;
>
> the errstr is always blank.  However, if I make a single change to
> anything....DSN name, server name in config files or user/pass then I
> get an error message.
>
> 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.
> Here is one of the combinations I tried:
>
> my
> $DSN="Driver=FreeTDS;Server=SPT-SQL02.DOMAIN.COM;Port=1433;Database=PTT;
> UID=user;PWD=pass";
> my $dbh = DBI->connect("dbi:ODBC:$DSN", 'user', 'pass', {PrintError =>
> 0});
>
> I also setup a test SQL Server 2008 database and reran make test for
> DBD::ODBC and everything looked great!
>
> Here is the last odbc.ini config file I used without using freetds.conf:
>
> [root@trafficdev1 root]# cat /etc/odbc.ini
> [ODBC]
> Trace = yes
> TraceFile       = /tmp/odbc.log
>
> [PTT]
> Driver                  = FreeTDS
> Description             = ODBC via FreeTDS
> Trace                   = yes
> TraceFile               = /tmp/ptt.log
> Server                  = SPT-SQL02.DOMAIN.COM
> Trusted Connection      = no
> Port                    = 1433
> Database                = PTT
> TDS_Version             = 8.0
>
> And the odbcinst.ini:
> ; Driver from freetds package
> [FreeTDS]
> Description     = ODBC for SQL Server
> Driver = /usr/local/lib/libtdsodbc.so
>
> I have the latest freetds installed and the following ODBC rpm's
> installed:
> unixODBC-2.2.8-2.3.0.2
> unixODBC-devel-2.2.8-2.3.0.2
>
> perl v5.8.0 and the following DBI mods:
>
> DBD::ODBC -- 1.22
> DBD::Oracle -- 1.15
> DBD::mysql -- 4.010
> DBI -- 1.43
>
> I'm up for anything else someone can think of!
>
> Thanks for all the replies so far.
>
> Scott k
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Michael Higgins
> Sent: Tuesday, June 23, 2009 11:33 AM
> To: [email protected]
> Subject: Re: [freetds] issues connecting with perl DBD::ODBC
>
> On Tue, 23 Jun 2009 11:03:10 -0400
> "Kulik, Scott" <[email protected]> wrote:
>
> > Anyone have any luck getting connected to a SQL server database with
> > DBD::ODBC in perl?  I'm hoping to try to get this issue fixed this
> > week but I'm out of ideas.
>
> Ah, joy. Just re-joined the list. Glad to see things are much the same.
> ;-)
>
> DBD::ODBC connection is totally possible and entirely opaque by
> complexity.
>
> Here are my configs for you to compare.
>
> /etc/freetds.conf
> # A typical Microsoft SQL Server 2000 configuration
> [TREX]
>        host = localhost
> #       port =1799
>        tds version = 7.0
>        dump file = /home/mykhyggz/Desktop/freetds.log
>
> /etc/unixODBC/odbc.ini
> [ODBC Data Sources]
> TREX = Microsoft SQL Server 2000
>
> [ODBC]
> Trace = yes
> TraceFile       = /home/mykhyggz/Desktop/odbc.log
>
> [TREX]
> Driver          = /usr/lib/libtdsodbc.so
> Description     = TREX Data
> Trace           = Yes
> TraceFile       = /home/mykhyggz/Desktop/trex.log
> Server          = 127.0.0.1
> Trusted Connection = no
> Port            = 1799
> Database        = TREX
> TDS_Version     = 7.0
>
> [Default]
> Driver          = /usr/lib/libtdsodbc.so
>
>
> /etc/unixODBC/odbcinst.ini
> [Default]
> Driver          = /usr/lib/libtdsodbc.so
>
> [FreeTDS]
> Description             = v0.63 with protocol v7.0
> Driver          = /usr/lib/libtdsodbc.so
> ;Setup  = /usr/lib/libtdsS.so
> ;UsageCount             = 2
>
> And a working connect string:
>
> 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');
>
> Probably there is something about having the Driver= line in there. Note
> I have an SSH tunnel from my machine on port 1799 through another linux
> box to the server.
>
> HTH.
>
> Cheers,
>
> --
>  |\  /|        |   |          ~ ~
>  | \/ |        |---|          `|` ?
>  |    |ichael  |   |iggins    \^ /
>  michael.higgins[at]evolone[dot]org
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



-- 
MVH Per Stenebo
Ballingslöv
0708-78 18 24
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.