RE: Strange question on .NET and Oracle connection
- From: "Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 8 Jul 2005 10:00:01 -0700
I am not sure where the issue is, but I would consider using the global Error
handler instead of setting up a try ... catch. This way all errors can be
redirected by your redirect and you can send the SQL specific exception to a
particular page.
You can also declaratively set up an error redirect in web.config, but this
will not allow you to weed out SQL connection issues.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Diffident" wrote:
> Hello All,
>
> I am trying to redirect users to a standby webpage in case our application
> is down due to database server failure. To facilitate this I am opening a
> test connection within a try/catch block in application_beginrequest event of
> global.asax and in case the connection could not be established, I am
> redirecting the users in the catch block.
>
> Now to the interesting part. I am in the testing phase of this feature.
> Since our production and development database server are the same I am using
> a different approach to test this. I am running the application from my local
> machine's web server and I am unplugging the network jack to simulate the
> database server failure which is located at some other place.
>
> So, once I unplug the network jack, the very first request should be
> redirected to standy page because techinically the connection to Oracle
> should not be established. But surprisingly this request is able to make a
> database connection even though there is no network connectivity. When I
> tried to debug and see, the execution was going well past the
> OracleConnection.open() successfully and not going into the catch loop. But
> the next request following this request is going into the catch block and is
> redirected. What is the reason behind this strange behavior. Does .NET cache
> the OracleConnections?
>
> Here is the code....
>
> System.Data.OracleClient.OracleConnection myDBConn =
> new System.Data.OracleClient.OracleConnection();
> try
> {
> myDBConn.ConnectionString =
> System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
> myDBConn.Open();
>
> }
> catch(OracleException ex)
> {
> //Database server is down; Redirect to standby page
> }
>
>
> Thanks a lot!!!
.
- References:
- Strange question on .NET and Oracle connection
- From: Diffident
- Strange question on .NET and Oracle connection
- Prev by Date: Advanced Installation Projects
- Next by Date: RE: How to allow Visual Studio to open projects on a server?
- Previous by thread: Strange question on .NET and Oracle connection
- Next by thread: Re: Strange question on .NET and Oracle connection
- Index(es):
Relevant Pages
|