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

Brian Menges bmenges at gogrid.com
Fri Jun 25 15:16:26 EDT 2010


Not quite sure on that one.  How might I check against that... or would the following code help me define it?

BEGIN
{
        $ENV{FREETDSCONF} = '/etc/freetds/freetds/conf';
        $ENV{SYBASE} = '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase';
}

Not sure what it should be set to... searching for Sybase resulted in the following (don't know if this is a help):

[12:18:09]$ locate Sybase
/usr/share/man/man3/DBD::Sybase.3
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.so
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase/.packlist
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.bs
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBD/Sybase.pm
[12:18:41]$ locate sybase
/usr/share/pear/DB/sybase.php
/usr/local/jboss-4.0.2/docs/examples/jca/sybase-ds.xml
/usr/local/jboss-4.0.2/docs/examples/jms/sybase-jdbc2-service.xml
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBD/dbd-sybase.pod
/opt/SUNWappserver/lib/install/databases/ejbtimer_sybase.sql
/var/www/adodb/drivers/adodb-sybase_ase.inc.php
/var/www/adodb/drivers/adodb-sybase.inc.php
/var/www/adodb/datadict/datadict-sybase.inc.php
/var/www/adodb4/drivers/adodb-sybase_ase.inc.php
/var/www/adodb4/drivers/adodb-sybase.inc.php
/var/www/adodb4/datadict/datadict-sybase.inc.php

I know that I have DBD::Sybase

[12:20:15]$ perl -MDBI -e 'DBI->installed_versions;'
  Perl            : 5.008005    (i386-linux-thread-multi)
  OS              : linux       (2.6.18-128.1.1.el5)
  DBI             : 1.609
  DBD::mysql      : 2.9004
  DBD::Sybase     : 1.10
  DBD::Sponge     : 12.010002
  DBD::Proxy      : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC
  DBD::Gofer      : 0.011565
  DBD::File       : 0.37
  DBD::ExampleP   : 12.010007
  DBD::DBM        : 0.03

---------------------------------------------------------
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.


-----Original Message-----
From: freetds-bounces at lists.ibiblio.org [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Dave Bialac
Sent: Friday, June 25, 2010 12:00 PM
To: FreeTDS Development Group
Subject: Re: [freetds] Coding issues using FreeTDS/DBD::Sybase in Perl

What are the contents of $SYBASE?  Is DBD::sybase linking against the correct location of freetds (you may have more than one library installed)?

Dave

On Jun 25, 2010, at 2:17 PM, Brian Menges wrote:

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

_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds


More information about the FreeTDS mailing list