Page 1 of 1
Site behavior when unable to connect to database
Posted: Mon Oct 25, 2010 2:18 pm
by HaggisMan
I have my Ablecommerce website on one server and the database on a different server. If the webserver is unable to establish a connection to database server, I'd like to trap that and redirect the user to an informative page. I am thinking that I could trap at the point where the initial db connection is made to load the store settings, but I can't find that point in the code. Where does Ablecommerce make the first db connection attempt?
Re: Site behavior when unable to connect to database
Posted: Tue Oct 26, 2010 3:39 am
by plugables
That is somewhere in the back-end code.
What you can do I guess is to trap the SQL exception in Global.asax and redirect the user to the info page.
Re: Site behavior when unable to connect to database
Posted: Tue Oct 26, 2010 9:14 am
by mazhar
What are the error details that you get in unavailable case of database server. I think you can try to catch error in Global.asax file's Application_Error method. Where you can try to parse the exception and see if its related to availability of database server then redirect to desired page.
Re: Site behavior when unable to connect to database
Posted: Tue Oct 26, 2010 11:54 am
by HaggisMan
Mazhar,
In my case the port was blocked at the firewall by mistake. All I received was: "Internet Explorer Cannot Display the Webpage". It appears that Ablecommerce isn't rendering anything until the database can be queried for the store settings. Where does Ablecommerce make the intial db connection?
Re: Site behavior when unable to connect to database
Posted: Wed Oct 27, 2010 4:34 am
by mazhar
The connection is made in back end code (dll) file.