|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: DB connection error handling
Date: Oct 15 2004 11:46AM
On Fri, 2004-10-15 at 13:02, phanikumar.pasam@wipro.com wrote:
> > Please can you help me handling the error in DB connection to Sybase
>
> > Server and DB from perl code myself?
> > I am using Sybperl. and all the libraries exist. I am saying this
>
> > because we make DB connection in numerous instances; But we have a
>
> > specific requirement to put XYZ logic incase DB connection is not
>
> > made.
Which version of sybperl do you have?
I just tried the following:
#!/usr/bin/perl -w
use strict;
use Sybase::DBlib;
my $db = new Sybase::DBlib 'sa', 'foo', 'localhost';
if(!$db) {
print "connect failed!\n";
} else {
print "connect worked\n";
}
__END__
which worked fine:
[mpeppler@localhost DBD-Sybase]$ perl ~/tmp/fail_con.pl
Msg 4002, Level 14, State 1
Server 'localhost',
Login failed.
DB-Library error:
Login incorrect.
connect failed!
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler@peppler.org http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html
|