Page 1 of 1

mysql maximum connections help

Posted: Sat Jun 17, 2006 11:44 pm
by ppc
My hosting provider only allows for 50 simultanious connections to a sql database at once and they said they wont change it. Does anyone know of a way that some sort of a script or something would check to make sure that the server can accept there connection and if not would hold them in a queue until a "spot" is avaiable to them to connect. This problem would be major for a vbulletin forum. Or if anyone has any other sugesstions that would be greatly appreciated.

Thanks.

PPC

Posted: Sat Jun 17, 2006 11:50 pm
by tecktalkcm0391
You might be able to do something like this:

Code: Select all

function databaseconnect(){
// Connection Stuff 
   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Data passata
   header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                                                        // sempre modificato
   header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
   header("Cache-Control: post-check=0, pre-check=0", false);
   header("Pragma: no-cache");                          // HTTP/1.0
   error_reporting(E_ALL);
   $host = 'localhost';
   $dbuser = '';
   $dbpass = '';
   $dbname = '';
   $table = '';
$db_connect = @mysql_connect($host,$dbuser,$dbpass);
   $db = mysql_select_db($dbname);
   if(!$db_connect)
   {
       databaseconnect();
   }
}
// Call to connect
databaseconnect();
This would try to connect to the database, and if it fails it would try again, until its available, it might make your code slower, but its something worth a shot for now

Posted: Sun Jun 18, 2006 6:23 am
by www.freemysql.net
I hope your not paying for it, they could up that setting just a tad. It’s only going to help - now if it happens all the time they need to find who is doing it and stop them.