|
|
sybperl-l Archive
Up Prev Next
From: "Heinz Ringlhofer" <Heinz dot Ringlhofer at zamg dot ac dot at>
Subject: Re: Handling Errors
Date: Feb 8 2002 2:11PM
You should establish message handlers
(See Sybperl examples)
On Feb 8, 13:35, Sabherwal, Balvinder (MBS) wrote:
> Subject: Handling Errors
> 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.
>
>-- End of excerpt from Sabherwal, Balvinder (MBS)
|