in reply to Problems connecting to server 2

Try using a "USE" statement in your "SELECT" statement. This will make sure that you have the correct database.
$sth=$dbh->prepare("SELECT * FROM users WHERE user LIKE 'sparkie' AND +passwd LIKE 'foo' USE master");
Another thing you may want to consider is using place holders in your prepares. This can speed up your code if you use similar statments.
use DBI(); my $user1 = 'sparkie'; my $user2 = 'c-era'; my $pass1 = 'foo'; my $pass2 = 'bar'; $dbh = DBI->connect("dbi:ODBC:TLRS",'sa','') or die "$DBI::errstr\n"; $sth=$dbh->prepare("SELECT * FROM users WHERE user LIKE ? and passwd L +IKE ? USE master"); $sth->execute($user1, $pass1); while($ref = $sth->fetchrow_hashref) { print"$ref->{'user'},$ref->{'passwd'},$ref->{'allow'}\n"; } $sth->execute($user2, $pass2); while($ref = $sth->fetchrow_hashref) { print"$ref->{'user'},$ref->{'passwd'},$ref->{'allow'}\n"; } $sth->finish(); $dbh->disconnect;
You may also want to consider using "=" instead of "LIKE". Using "=" will increase your performance, but there are times that you will have to use "LIKE".

I hope this helps.