For my plugin I need to allow the user to use different databases, hosts, users and passwords therefor I created my own wpdb class instance:
$phpbbdb= new wpdb($pBBuser, $pBBpassword, $pBBdb, $pBBhost);
But if now something after this line access the database through the wpdb instance is using the phpbbdb resource id and therefor the Query isn't successful as the database don't hold these wordpress tables.
To remove this problem I need to use this line at the end of my code:
$phpbbdb= new wpdb(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST);
As I found out, this problem can easily be resolved by changing this line, within the wp-db.php file:
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
into this one:
$this->dbh = @mysql_pconnect($dbhost, $dbuser, $dbpassword);
I'm not sure if this change would create other problems as I'm not too deep into PHP+MySQL, but while working with the persistance connection, I didn't encounter some Problems.
Thanks