Ajude o Mysql a resolver o handle por.
Ao invés de:
$res=$dbh->query('SELECT * FROM table');
Tentar:
$res=$dbh->query('SELECT * FROM Mydatabase.table');
$res=$dbh->query('SELECT * FROM table');
$res=$dbh->query('SELECT * FROM Mydatabase.table');