As announced in OnSite and our public status page, we'll be taking our MySQL 5 server (db1.modwest.com) offline for up to thirty minutes tomorrow (Thursday) night around 7PM Mountain Time for system upgrades. If your site utilizes this server and you're a programmer (or have one nearby), you may want to consider making sure your web applications handle the maintenance window gracefully. (I'll post a technical comment below for one way to do so.)
Speaking of MySQL, the company that produces this excellent open-source database software was just acquired by Sun Microsystems, an enterprise hardware and software company. Only time will tell, but we anticipate this will result in some powerful improvements to the already-great MySQL software.
-JM
I've recently set up graceful database connection problem handling for one of the sites I maintain. Here's a quick way to do it.
First, create a static HTML page which explains that there was a problem connecting the the database, but all is well and soon you'll be back and functioning at full capacity.
Next, in your PHP mysql_connect() code, redirect the browser to the static HTML page conditionally -- if the database connection fails. For example:
if(!$dbh = mysql_connect("db1.modwest.com", $myuser, $mypass) )
{
header("Location: http://mysite.com/errorpage.html \n");
exit;
}
If your database connection code exists within the HTML output of your dynamic pages, however, the header() won't work. In that case, you might just want to print an explanatory message on the page, or use the META tag as described here:
http://webmaster.iu.edu/tool_guide_info/refresh_metatag.shtml
If you run into trouble, just let us know at support at modwest dot com and we'll try and point you in the right direction.
-JM
Posted by: jmasterson | January 16, 2008 at 04:48 PM
JM ... you can also accomplish the same thing using "include()", where the included script prints the error message.
Anyway, The acquisition MySQL by Java will be interesting. Perhaps it is time to brush off my old Java books. I prefer Java as a language. I just never liked their connection to the database.
Posted by: Kevin Delaney | January 17, 2008 at 11:42 AM