Re: issues connecting with perl DBD::ODBC
"Kulik, Scott" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <367B33A3B0BA27429CC76B74A71EECC44A193B@snaex01.ms.severstalna.com> |
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. Thanks Scott K -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kulik, Scott Sent: Friday, June 19, 2009 5:20 PM To: [email protected] Subject: [freetds] issues connecting with perl DBD::ODBC Hi, I am trying to connect to a SQL Server from perl. I have successfully configured ODBC and freetds under Redhat Linux ES4 and am able to connect with tsql and isql. For some reason though, the test perl connection script is coming back with an error. Here is my info: [root@trafficdev1 root]# cat /etc/odbc.ini [PTT] Driver = FreeTDS Description = ODBC via FreeTDS Servername = SPT-SQL02 Database = PTT [root@trafficdev1 root]# cat /etc/odbcinst.ini # Driver from freetds package [FreeTDS] Description = ODBC for SQL Server Driver = /usr/local/lib/libtdsodbc.so Setup = /usr/lib/libtdsS.so /usr/local/etc/freetds.conf [SPT-SQL02] host = SPT-SQL02.DOMAIN.COM port = 1433 tds version = 8.0 client charset = UTF-8 Here is the sample perl script I am using from the freetds site: #!/usr/bin/perl use DBI; my $dbh = DBI->connect('dbi:ODBC:PTT', 'user', 'pass', {PrintError => 0}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth; $sth = $dbh->prepare("select \@\@servername"); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } Here is the output from the script: [root@trafficdev1 root]# ./test_odbc.pl Unable for connect to server at ./test_odbc.pl line 7. I have been playing around with different perl scripts for a while now but haven't had any success yet. I would really appreciate if anyone else has some ideas. Thanks! Scott K _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds