Hi, Do you mean replace "dbname=dbA" with "dbname=dbB" in my connect string? I've tried that. Is there another way to switch the data source to another db?
Is there any fix for this DBD::Sybase bug? Thanks, Bilal On Thu, 11 Sep 2003, Chuck Fox wrote: > [EMAIL PROTECTED] wrote: > > >Hi, > > > > > Hello, > > >I'm trying to connect to two ms sqlserver 2000 databases with the same schema > >(let's call them > >dbA and dbB) using the following code: > > > >my $connect_string = "dbi:Sybase:dbname=dbA:server=MyServer"; > >$connect_string .= ";host=192.168.0.2;port=1433"; > > > >my $dbh = DBI->connect($connect_string, $username, $userpass, {PrintError => > >0}); > >die "Unable for connect to server $DBI::errstr" > > unless $dbh; > > > >and in my freetds.conf I have: > > > >[MyServer] > > host = 192.168.0.2 > > port = 1433 > > tds version = 4.2 > > try domain login = no > > try server login = yes > > > > > >I have read access to both dbA and dbB. However if dbB is my default db and I > >specify dbA as the dbname (as in the example above), or vice versa, when my > >script executes the following: > > > > > Why not just "use dbB" or whichever is appropriate to the query ? I > seem to remember some bug in Sybase DBD that prevented it from > using/processing the database specified in the connect string. > > >$sth = $dbh->prepare("select count(*) from array"); > >die "Unable for connect to server $DBI::errstr" unless $sth; > >if($sth->execute) { > > while(my @dat = $sth->fetchrow) { > > print "@dat\n"; > > } > >} > > > >the data is retrieved from the default db rather than the one I specified (btw, > >yes, i know for sure that the "select count(*) from array" on both db's should > >return different numbers). So I think that DBI's only connecting to the > >default db. > > > >As well, the statment > > > >print "Data sources: " . ($dbh->data_sources()) . "\n $DBI::errstr\n"; > > > >prints out no data sources. > > > >The DBD I'm using is DBD::Sybase running on the freetds library. My script's > >running on a linux box and the sqlserver 2000 db's are on a windows 2000 adv > >server box. > > > >So any ideas on how I may get around this problem? I would really appreciate > >any help. > > > >Thanks, > >Take care, > >Bilal > > > HTH, > > Chuck Fox > Principal DBA > America Online, INC > >