Site behavior when unable to connect to database

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
HaggisMan
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Tue Aug 17, 2010 2:41 pm

Site behavior when unable to connect to database

Post by HaggisMan » Mon Oct 25, 2010 2:18 pm

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?

plugables
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Sat Aug 15, 2009 4:04 am
Contact:

Re: Site behavior when unable to connect to database

Post by plugables » Tue Oct 26, 2010 3:39 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Site behavior when unable to connect to database

Post by mazhar » Tue Oct 26, 2010 9:14 am

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.

HaggisMan
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Tue Aug 17, 2010 2:41 pm

Re: Site behavior when unable to connect to database

Post by HaggisMan » Tue Oct 26, 2010 11:54 am

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?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Site behavior when unable to connect to database

Post by mazhar » Wed Oct 27, 2010 4:34 am

The connection is made in back end code (dll) file.

Post Reply