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: John Gilmore-Baldwin <john at dwx dot com>
Subject: Re: error handlers
Date: Jun 2 1999 3:16PM

Actually, I do have a message handler.  It was working fine, though, so I
didn't bother pasting it in.

It turns out that I was just being boneheaded.  I didn't "use
Sybase::DBlib;".  Instead, I fully qualified the login, but that didn't
give me the error codes properly.

Thanks for the help, though.  I made the other modifications to my error
handler.

John

>John Gilmore-Baldwin writes:
> > I'm having problems getting error handlers to work correctly.  If I don't
> > specify an error handler, the program works fine.  If I do, and the error
> > handler gets hit, my program dies immediately.
>
>You probably want to set a message handler as well. The message
>handler is called first for errors that happen in the server (SQL
>errors, syntax errors, etc). The error handler will be called for
>system errors (can't connect to the server, for example), and will
>also be called *after* the message handler for server errors (that is
>the reason for the
>
> > 	if ($error != SYBESMSG)
> > 	{
> > 		print STDERR ("Sybase error: ", $error_msg, "\n");
> > 		print STDERR ("OS Error: ", $os_error_msg, "\n") if defined
> > ($os_error_msg);
> > 	}
>
>bit in the example error handler - only print these messages if the
>error is NOT SYBEMSG - ie it's not an error message that comes from
>the server.
>
>Try to base your code off of the examples in sybutil.pl...
>
> >
> > sub SQLerrorHandler
> > {
> > 	my ($Database, $Severity, $Error, $OSerror, $ErrorMsg, $OSerrorMsg)
> > = @_;
>
>Note that $Database is not a string, it's the $database handle (ie the
>connection) and may be undefined. It is possible that the
>
>	print "$Database"
>
>is what's causing your script to exit.
>
>Michael
>--
>Michael Peppler         -||-  Data Migrations Inc.
>mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
>Int. Sybase User Group  -||-  http://www.isug.com
>Sybase on Linux mailing list: ase-linux-list@isug.com