Skip to Content.
Sympa Menu

freetds - [freetds] Coding issues using FreeTDS/DBD::Sybase in Perl

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Menges <bmenges AT gogrid.com>
  • To: "freetds AT lists.ibiblio.org" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Coding issues using FreeTDS/DBD::Sybase in Perl
  • Date: Fri, 25 Jun 2010 11:17:43 -0700

I'm starting to get a little flustered and according to what I've read in
documentation (brief) and examples from web searching, I'm stuck and it is
driving me nuts <breath>.

So let me start with the basics:

DBD::Sybase version 1.10 loaded from
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBD/Sybase.pm


[10:03:17]$ tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.82
freetds.conf directory: /usr/local/etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: no

[10:59:43]$ ls -la /usr/local/etc/freetds.conf
lrwxrwxrwx 1 root root 25 Feb 15 2006 /usr/local/etc/freetds.conf ->
/etc/freetds/freetds.conf

[11:02:08]$ cat /etc/freetds/freetds.conf
[global]
tds version = 4.2
initial block size = 512
swap broken dates = no
swap broken money = no
try server login = yes
try domain login = no
cross domain login = no
text size = 64512

[griddbstage]
host = griddbstage
port = 1433
tds version = 7.0

--

Now, with the above configuration I can connect using the command line to my
database:

[11:02:30]$ tsql -S griddbstage -U brian -D gogrid
locale is "en_US.UTF-8"
locale charset is "UTF-8"
Password:
Default database being set to gogrid
1> exit

But attempts to use perl have resulted in a message that plagued me earlier
at the command line:

use DBI;
...
DBI->trace(4);
my $c_ggdb = DBI->connect("DBI:Sybase:$dbserv",$dbuser,$dbpass)
or die "Cannot log into $dbserv\n";
...

With the trace as follows:

---
DBI 1.609-ithread default trace level set to 0x0/4 (pid 26790) at
ggsmtp.pl line 106
-> DBI->connect(DBI:Sybase:griddbstage, brian, ****)
-> DBI->install_driver(Sybase) for linux perl=5.008005 pid=26790
ruid=2632 euid=2632
install_driver: DBD::Sybase version 1.10 loaded from
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBD/Sybase.pm
<- install_driver= DBI::dr=HASH(0x977dc84)
!! warn: 0 CLEARED by call to connect method
-> connect for DBD::Sybase::dr (DBI::dr=HASH(0x977dc84)~0x977de70
'griddbstage' 'brian' **** HASH(0x96af038)) thr#9362008
syb_db_login() -> using global CS_LOCALE data
clientmsg_cb -> Unable to connect: Adaptive Server is unavailable or does
not exist
<> DESTROY(DBI::db=HASH(0x9783bf0)) ignored for outer handle (inner
DBI::db=HASH(0x9783b90) has ref cnt 1)
-> DESTROY for DBD::Sybase::db (DBI::db=HASH(0x9783b90)~INNER) thr#9362008
DESTROY for DBI::db=HASH(0x9783b90) ignored - handle not initialised
ERROR: 41 'OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY =
(78) NUMBER = (41)
Server griddbstage, database
Message String: Unable to connect: Adaptive Server is unavailable or does not
exist
' (err#0)
<- DESTROY= undef at
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 653 via
at ./ggsmtp.pl line 107
dbih_clearcom 0x9783b90 (com 0x9784300, type 2) done.

!! ERROR: 41 'OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY =
(78) NUMBER = (41)
Server griddbstage, database
Message String: Unable to connect: Adaptive Server is unavailable or does not
exist
' (err#0)
<- connect= undef at
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 653
-> $DBI::errstr (&) FETCH from lasth=HASH
>> DBD::Sybase::dr::errstr
<- $DBI::errstr= 'OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY =
(78) NUMBER = (41)
Server griddbstage, database
Message String: Unable to connect: Adaptive Server is unavailable or does not
exist
'
DBI connect('griddbstage','brian',...) failed: OpenClient message:
LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (41)
Server griddbstage, database
Message String: Unable to connect: Adaptive Server is unavailable or does not
exist

DBI connect('griddbstage','brian',...) failed: OpenClient message: LAYER =
(0) ORIGIN = (0) SEVERITY = (78) NUMBER = (41)
Server griddbstage, database
Message String: Unable to connect: Adaptive Server is unavailable or does not
exist
at ./ggsmtp.pl line 107
Cannot log into griddbstage
-- DBI::END ($@: , $!: )
!! ERROR: 41 CLEARED by call to disconnect_all method
-> disconnect_all for DBD::Sybase::dr (DBI::dr=HASH(0x977dc84)~0x977de70)
thr#9362008
<- disconnect_all= 1 at
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 732 via
at ./ggsmtp.pl line 0
! <> DESTROY(DBI::dr=HASH(0x977dc84)) ignored for outer handle (inner
DBI::dr=HASH(0x977de70) has ref cnt 1)
! -> DESTROY in DBD::_::common for DBD::Sybase::dr
(DBI::dr=HASH(0x977de70)~INNER) thr#9362008
! <- DESTROY= undef during global destruction
dbih_clearcom 0x977de70 (com 0x97813a8, type 1) done.
---

I'm not sure if this is the right place to be asking this, because I can
force my perl program down to system cmd line and read from there... but I
shouldn't have to kluge this. Should I be addressing this with DBD::Sybase
or here? I'm horribly confused, and wondering if I'm just missing something
stupidly obvious.

Appreciate the help.

---------------------------------------------------------
Brian S. Menges
Support Supervisor / Abuse Administrator
2 Harrison, Suite 200|San Francisco, CA|94105
D 415.869.7000|F 415.869.7001

Making IT Infrastructure: Simpler. Faster. Better.
 Please consider the environment before printing this email.



Archive powered by MHonArc 2.6.24.

Top of Page