PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Jamie Belanger <jamie_belanger at globalcrossing dot com>
Subject: Sybperl, loops, and unfortunate information retention.
Date: May 17 2000 4:57PM

As follows is a portion of code that I'm attempting to use to gather hourly
statistics for a few of our servers... When I run the script, the Picard
loop executes correctly. However, the elsif for Data and Dax both spit out
sybase error messages which indicate that they are attempting to use
Picard's database names still (Attempt to locate entry in sysdatabases for
database '_______' by name failed - no entry found under that name. Make
sure that
name is entered properly). All of the variables are unique, and I was
wondering if there is something quirky with attempting multiple sybase
sessions within one script?
----------------------------------------------------------------------------
--

@servers=(picard,data,dax);

$SQL="sp_spaceused syslogs";


foreach $server (@servers){

        if($server=="picard"){
                @picard=(billing,toll1,toll5,toll6,toll9,rating);
                $X = Sybase::CTlib->ct_connect($uid, $passwd, $server);

                foreach $database_picard (@picard){
                #print $database;
                        $X->ct_sql("use $database_picard");
                        $X->ct_execute($SQL);

                        while($X->ct_results($restype) == CS_SUCCEED){
                                next if(!$X->ct_fetchable($restype));
                                        while(@dat_picard = $X->ct_fetch){
                                                @translog_picard =
(@translog_picard, @dat_picard);
                                                #print @translog_picard;
                                        }
                        }
                }
        }elsif($server=="data"){
                @data=(admin,debit5,oecs);
                $Y = Sybase::CTlib->ct_connect($uid, $passwd, $server);

                foreach $database_data (@data){
                        $Y->ct_sql("use $database_data");
                        $Y->ct_execute($SQL);

                        while($Y->ct_results($restype) == CS_SUCCEED){
                                next if(!$Y->ct_fetchable($restype));
                                        while(@dat_data = $Y->ct_fetch){
                                                @translog_data =
(@translog_data, @dat_data);
                                        }
                        }
                }
        }elsif($server=="dax"){
                @dax=(toll2,toll3,toll4,toll7,toll8,force);
                $Z = Sybase::CTlib->ct_connect($uid, $passwd, $server);

                foreach $database_dax (@dax){
                        $Z->ct_sql("use $database_dax");
                        $Z->ct_execute($SQL);

                        while($Z->ct_results($restype) == CS_SUCCEED){
                                next if(!$Z->ct_fetchable($restype));
                                        while(@dat_dax = $Z->ct_fetch){
                                                @translog_dax =
(@translog_dax, @dat_dax);
                                        }
                        }
                }
        }

}

Jamie Belanger
System Administrator
Global Crossing
(319) 298-1489 or ext. 489




-----Original Message-----
From: Michael Peppler [mailto:mpeppler@peppler.org]
Sent: Friday, April 14, 2000 9:16 AM
To: SybPerl Discussion List
Cc: modperl@apache.org; SYBPERL-L@list.cren.net
Subject: Re: PHP is breaking Sybase::DBlib


David Hojo Hajoglou writes:
 > So, I was having a hell of a time to get DBlib to work in a module.  The
 > code worked fine as a script, but the database handle was not created
 > properly when with a module.  As I prepared for Harikari, I looked at the
 > loggs and php glared back at me.
 >
 > My compile was:
 > Apache/1.3.12 (Unix) mod_perl/1.22 PHP/3.0.15
 >
 > Change to
 > Apache/1.3.12 (Unix) mod_perl/1.2
 >
 > And the code worked. So, I have discovered an incompatibility of sorts
and
 > guess what?  I have no idea how to fix it only that I need to have php
and
 > mod_perl together.  Why me????  AAAGH.

Do you happen to have libdb (berkeley DB) linked in to the first
mod_perl binary? libdb.a and SYbase DBlib both have a dbopen()
function, and that causes some (obvious) problems.

Michael
--
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com