Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: client api layer error
Date: Jun 6 2001 2:19PM

Patrick S Leung writes:
 > Dear all,
 > I use a perl script to fetch data from sever sybase ase dbs.  The perl 
 > scripts are on one linux machine while the db is on another linux 
 > machine.  All but one sybase server gave me the open client error.  I 
 > got the error even if I run the perl script on the same machine. 
 > Open Client Message:
 > Message number:  LAYER = (1) ORIGIN = (1)  SEVERITY = (1) NUMBER = (163)
 > Message String:  ct_results():  user api layer: external error:  This 
 > routine cannot be called until all fetachable results have been 
 > completely processed.

Your perl code is almost certainly incorrect. You *must* call
ct_fetch() within the ct_results() loop for *all* result types that
return rows, even if there are no rows in that result set.

Specifically you need to do something like this (semi-pseudocode):

while(ct_results($restype) == CS_SUCCEED) {
    next unless ct_fetchable($restype);
    while(@d = ct_fetch) {

If you don't want to have to mess with all that I strongly suggest you
take a look at Sybase::Simple, where you have methods that will hide
all this complexity from you.

Michael Peppler - Data Migrations Inc. - -
International Sybase User Group -
Sybase on Linux mailing list: