DB - too many connections error
| From: | mishal at centrum dot cz | Date: | Fri, 02 Apr 2004 08:14:24 +0000 |
| Subject: | DB - too many connections error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11582@lists.php.net to get a copy of this message | ||
hello,
some time ago i asked for help with "too many connections" error (with mysql).
using DB package.
but i got no response.
i wanted to catch this error and inform the visitor about this event on a nice
page.
i solved the problem with a little hack in db/mysql class.
i found that "too many connections" error has code 1203,
so i added a line into errorcode_map, 1203 => DB_ERROR_TOOMANYCONNECTIONS
now im able to catch this error using db::
$dbh =& DB::connect($dsn, $options);
if (DB::isError($dbh)) {
$code = $dbh->getCode();
if($code == DB_ERROR_TOOMANYCONNECTIONS) {
// show too many connetions page!
}
}
am i right??
could this error type be added into the class?
thank you for your time!!
michi
--
Best regards,
mishal mailto:mishal@centrum.cz