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 MBAY dot NET>
Subject: Re: Dead connections
Date: Dec 12 1997 12:51AM

Todd E. Scheresky wrote:
> Greetings,
> This question IS NOT for the faint of heart.  First some background.  I
> am running Perl 5.004_04, Sybperl 2.07, on AIX 4.1.3.  The Perl script,
> extremely bastardized, follows at the end of this email.
> I run the script in two ways.  First, from the command line and second,
> I call the subroutine "resolveIP" repeatedly from a C program. 

Do you just call the subroutine, or do you call the script repeatedly?

>  From the C program the script runs
> fine on the first call to "resolveIP".  However, if I call "resolveIP" a
> second time, and repeatedly thereafter, on the first host "getIP" dies
> because ct_execute returns a CS_FAIL.  It's as if the database
> connection to Sybase is no longer valid. 

Do you get any other message from the client callback?

> to longer than 60 seconds and ct_config failed with the following error.
> I used "ct_config(CS_SET, CS_LOGIN_TIMEOUT, 900);" I got back:
> Open Client Message: (In msg_cb)
> Message number: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (9)
> Message String: ct_config(SET,LOGIN_TIMEOUT): user api layer: external
> error: The buflen parameter must be set to CS_UNUSED.

You need to add a CS_INT_TYPE parameter to your ct_config() call.

> So what the heck is happening here?  Why can I only run "resolvedIP"
> successfully once?

Strange. Based on what you specify the script should run fine.

A small point though - you are passing \$dbh as parameter to getip().
THat is not necessary, as $dbh is already a reference.

Michael Peppler       -||-  Data Migrations Inc.  -||-