--- contrib/mod_mysql.c.old	Sun Feb 11 20:19:00 2001
+++ contrib/mod_mysql.c	Sun Feb 11 20:21:29 2001
@@ -100,6 +100,9 @@
 	     mysql_get_client_info (), mysql_get_server_info (mysqldb),
 	     g.sql_user, g.sql_host);
 
+  if (mysqldb)
+    mysql_select_db (mysqldb, g.sql_dbname);
+
   return HANDLED (cmd);
 }
 
@@ -115,7 +118,7 @@
 
   /* This forces a quick ping of the remote server, so we know if its there. */
   if (mysqldb)
-    mysql_select_db (mysqldb, g.sql_dbname);
+    mysql_ping( mysqldb );
 
   if (!mysqldb
       || ((error = mysql_query (mysqldb, query))
