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: "Sabherwal, Balvinder (MBS)" <Balvinder dot Sabherwal at mortgagefamily dot com>
Subject: Handling Errors
Date: Feb 8 2002 1:20PM

Guru's

I have a perl script and I am trying to trap the errors at the time of
establishing the connection to the server. The code I use to this is below,
however this it not woring as I don't get the error message printed.

$dbhndl = Sybase::CTlib->ct_connect($usr, $pswd, $Srv); ## Connect to the
server.

if($dbhndl eq "CS_FAIL")
{
print<<"_END_";

Connection to server failed.

This could be due to an invalid Login Name,Password,Server. If you feel all of these are correct, then pls check of the server is running and your login is not locked. Still if you can't connect, Pls check you interfaces of sql.ini files. _END_ ; } Can some one help me in getting this work. I executed the script in the debug mode and the output for the error is as below main::(isqlt.cgi:42): $dbhndl = Sybase::CTlib->ct_connect($usr, $pswd, $Srv); ## Connect to the server. DB<1> Server message: Message number: 4002, Severity 14, State 1, Line 1 Server 'SYB_NJ6' Message String: Login failed. Open Client Message: Message number: LAYER = (4) ORIGIN = (1) SEVERITY = (4) NUMBER = (44) Message String: ct_connect(): protocol specific layer: external error: The attempt to connect to the server failed. main::(isqlt.cgi:44): if($dbhndl eq "CS_FAIL") main::(isqlt.cgi:45): { DB<1> p $dbhndl DB<2> How can I print the error msg returned from the server along with the error msg I am trying to print?? Thanks Bal.