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: <salvatore dot sferrazza at ny dot ubs dot com>
Subject: Re: Simple Question
Date: Sep 9 1997 3:07PM

     I was having this problem and I decided to break up all my different 
     db operations (updates, queries, etc) into seperate subroutines with 
     each sub having a unique $dbh.  This made my code a *little* more 
     modular and manageable.  Basically what is probably happening is that 
     your $dbh has a resultset still available for processing, but you are 
     sending it dbcmd's and more results, and this is what Sybase is 
     complaining about.  If you give each process its own $dbh this will no 
     longer happen.
     
     HTH,
     
     Sal
     
     p.s. I am a little new at this also, so if there is some faulty logic 
     above I welcome the gurus to set me straight.
     
     
______________________________ Reply Separator _________________________________
Subject: PUBLIC: Simple Question
Author:  jeremy (jeremy@ptd.net) at nyux 
Date:    9/9/97 10:34 AM
     
     
     
Basically I'm getting an error:
     
DB-Library error:
        Attempt to initiate a new SQL Server operation with results
pending.
DB-Library error:
        Attempt to initiate a new SQL Server operation with results
pending.
DB-Library error:
        Attempt to initiate a new SQL Server operation with results
pending.
     
I'm a beginner so I'm still trying to work things out, but what I'm trying 
to do should be very simple.  Here's the perl program doing the 
processing:
     
#!/usr/local/bin/perl
#
# Query/Update Cable DB by anything. 
#
     
#perl includes
use Sybase::DBlib;
     
# do query
$dbh = new Sybase::DBlib 'foo', 'bar', 'DBSRV' || die "Hmmm...$!"; 
$dbh->dbuse('Accounting');
  $dbh->dbcmd("select * from Cable_cust");
     
$dbh->dbsqlexec;
$dbh->dbresults;
     
# retrieve and place values
while(($ID, $ENTRY_DATE, $TESTER, $CABLE_COMPANY, $FIRST_NAME, $MIDDLE_INITIAL, 
$LAST_NAME, $CONTACT_NAME, $COMPANY_NAME, $STREET_ADDRESS, $STATE, $ZIP, $PHONE,
 $CABLE_STATUS, $CABLE_IP_ADDRESS, $BOX_IP_ADDRESS, $SERIAL_NUMBER, $MAC_NUMBER,
     
 $PROSPECT, $IN
     
STALLED, $INSTALL_DATE, $AVAIL_NO_ORDER, $NOT_AVAIL, $EST_DATE_AVAIL, $EMAIL, $D
IAL_UP_CUSTOMER, $ACCOUNT_NUMBER) = $dbh->dbnextrow) {
     
($FIRST, $SECOND, $THIRD, $FOURTH, $FIVE) = split(/\s* /, $CONTACT_NAME);
     
# print "$CONTACT_NAME\n";
print "$FIRST $SECOND $THIRD $FOURTH $FIVE";
     
$dbh->dbcmd("update Cable_cust set FIRST_NAME='$FIRST', LAST_NAME='$SECOND $THIR
D $FORTH $FIVE' where CONTACT_NAME = '$CONTACT_NAME'");
  $dbh->dbsqlexec;
  $dbh->dbresults;
     
print "...Done.\n";
     
}
     
     
Thank for any help!
     
-jeremy