|
|
sybperl-l Archive
Up Prev Next
From: <phanikumar dot pasam at wipro dot com>
Subject: DB connection error handling
Date: Oct 15 2004 11:02AM
> 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.
>
>
>
> The following is the code
>
> ======================
>
> $getPwdHistauthDB = new Sybase::DBlib $Globals::II_Adm_dbuser,
>
>
> $getPwdHistPwd,$Globals::II_Adm_dbserver ;
>
>
> If(defined($getPwdHistauthDB))
>
> {
>
> $getPwdHistauthDB->dbuse($Globals::II_Adm_dbdatabase);
>
> ...........
..........
>
> else
>
> {
>
###########
#I want to write some logic here
#But Perl exits invariably if the connection fails
#which means the execution never comes here
###########
>
> .....
>
> }
>
> ======================
>
>
>
>
>
> If I give wrong user/pwd/Server/Database, I do not want to exit from
> the perl code completely. Rather I want to take
>
> a different route incase I do not establish the DB connection for
> whatever reason.
>
>
>
> I tried using ...
>
>
>
> warn() if $@ ;
>
>
>
> But in vain.
>
>
>
> Any help in this regards is appreciated.
>
>
>
> Thanks and Regards
>
> Phani Kumar
Phani Kumar P
+91-080-28520408 X-1354
phanikumar.pasam@wipro.com
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.
|