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: Narasayya Immid <narasan at yahoo dot com>
Subject: Re: dblib connection question..
Date: Mar 24 1999 9:14PM

Thanks Micheal, it worked.

- Narasayya
------------------------------------------------------

--- Michael Peppler  wrote:
> Narasayya Immid writes:
>  > Hi Everyone,
>  > 
>  >     I am using sybperl DBlib to connect to
> database, as
>  > 
>  > foreach $server (keys % SYNC_SERVER_LIST)
>  > {
>  > $dbh2 =
> Sybase::DBlib->dblogin("$user",$user_pwd,$server);
>  > 
>  >   if($dbh2 != null)
>  >      ....do some action..
>  > }
>  > 
>  > The connection is been called in a loop for three
> sybase servers. If for
>  > some reason, one server is down, the above login
> call aborts the entire
>  > program, by giving a 
>  > message : DB-Library: Unable to connect: SQL
> Server is unavailable or
>  > does not exist. 
> 
> The problem must be in your error/message handlers.
> 
> I tried this, both with the sybutil.pl handlers and
> with nothing at
> all, and it worked fine:
> 
> #!/usr/local/bin/perl
> 
> use Sybase::DBlib;
> 
> require 'sybutil.pl';
> 
> my @servers = qw(foo plum nunya kiruna);
> 
> foreach (@servers) {
>     $dbh = new Sybase::DBlib 'webuser', 'webuser',
> $_;
>     if($dbh) {
> 	print "Could connect to $_\n";
> 	exit(0);
>     }
>     print "Couldn't connect to $_... trying next\n";
> }
> 
> kiruna (6:20PM):596 > perl ~/tmp/m.pl 
> Sybase error: Server name not found in interface
> file.
> Couldn't connect to foo... trying next
> Sybase error: Unable to connect: SQL Server is
> unavailable or does not exist.
> Couldn't connect to plum... trying next
> Could connect to nunya
> kiruna (6:20PM):596 > 
> 
> 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
> 
> 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com