RE: Strange question on .NET and Oracle connection

Tech-Archive recommends: Fix windows errors by optimizing your registry



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!!!
.



Relevant Pages

  • Re: How to make multiple or consecutive webrequests using the same connection or session
    ... For connection persistence, you can use the ConnectionGroupName property. ... > (somehow...I'm not sure if it's an http redirect or what) the request ... So, after the first request, I need to ... > Dim WR As HttpWebRequest ...
    (microsoft.public.dotnet.framework)
  • Strange question on .NET and Oracle connection
    ... I am trying to redirect users to a standby webpage in case our application ... global.asax and in case the connection could not be established, ... Since our production and development database server are the same I am using ... So, once I unplug the network jack, the very first request should be ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: exact url typed in browser
    ... > for a default page, and if found, then sends a redirect to the browser. ... Connection: close ... request internally, maybe using Server.Transfer? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Strange question on .NET and Oracle connection
    ... ¤ Hello All, ... I am trying to redirect users to a standby webpage in case our application ... is down due to database server failure. ... global.asax and in case the connection could not be established, ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Running RDP on New Laptop will not redirect Printer, What to do?
    ... I wiped the OS on the laptop and reinstalled it. ... Once it was capable of connection to the WAN, I launched the RDP client I ... refer to as "Cathie" it still would not redirect the printer. ...
    (microsoft.public.windows.terminal_services)