RE: DB connection error handling

"Joglekar, Ashu [IT]" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase
Message-ID <[email protected]>
Phani,
 
You would need to replace the default error handlers with your own. The sybperl manpage ( http://www.mbay.net/~mpeppler/Sybperl/sybperl.html) has an example.
 
Ashu

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of [email protected]
Sent: Friday, October 15, 2004 7:03 AM
To: [email protected]
Subject: DB connection error handling



> 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

[email protected]

 



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 [email protected] immediately
and destroy all copies of this message and any attachments.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.