The wpdb object can be used to access any database and query any table. Absolutely no need to be WordPress related, which is very interesting. The benefit is the ability to use all the wpdb classes and functions like get_results, etc.
$mydb = new wpdb('username','password','database','localhost');
$rows = $mydb->get_results("select Name from my_table");
echo "<ul>";
foreach ($rows as $obj) :
echo "<li>".$obj->Name."</li>";
endforeach;
echo "</ul>";
Reference Links
https://wordpress.stackexchange.com/questions/1604/using-wpdb-to-connect-to-a-separate-database