Updated to reconnect and get new dbh every connection