473,667 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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. To facilitate this I am opening a
test connection within a try/catch block in application_beg inrequest 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
OracleConnectio n.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 OracleConnectio ns?

Here is the code....

System.Data.Ora cleClient.Oracl eConnection myDBConn =
new System.Data.Ora cleClient.Oracl eConnection();
try
{
myDBConn.Connec tionString =
System.Configur ation.Configura tionSettings.Ap pSettings["ConnectionStri ng"];
myDBConn.Open() ;

}
catch(OracleExc eption ex)
{
//Database server is down; Redirect to standby page
}
Thanks a lot!!!
Nov 19 '05 #1
2 1493
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_beg inrequest 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
OracleConnectio n.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 OracleConnectio ns?

Here is the code....

System.Data.Ora cleClient.Oracl eConnection myDBConn =
new System.Data.Ora cleClient.Oracl eConnection();
try
{
myDBConn.Connec tionString =
System.Configur ation.Configura tionSettings.Ap pSettings["ConnectionStri ng"];
myDBConn.Open() ;

}
catch(OracleExc eption ex)
{
//Database server is down; Redirect to standby page
}
Thanks a lot!!!

Nov 19 '05 #2
On Fri, 8 Jul 2005 08:29:04 -0700, Diffident <Di*******@disc ussions.microso ft.com> 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_beg inrequest 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
¤ OracleConnectio n.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 OracleConnectio ns?
¤
¤ Here is the code....
¤
¤ System.Data.Ora cleClient.Oracl eConnection myDBConn =
¤ new System.Data.Ora cleClient.Oracl eConnection();
¤ try
¤ {
¤ myDBConn.Connec tionString =
¤ System.Configur ation.Configura tionSettings.Ap pSettings["ConnectionStri ng"];
¤ myDBConn.Open() ;
¤
¤ }
¤ catch(OracleExc eption ex)
¤ {
¤ //Database server is down; Redirect to standby page
¤ }
¤

When you open a connection there is a request to the connection pool before attempting to open a new
connection. My guess is that your open statement is using an existing connection from the pool.

You will probably need to do a bit more work in order to determine whether that connection can still
talk to the database.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14515
by: Harry | last post by:
Using Oracle 8i enterprise on win 2000 (sp3) Installed the standard configuration & whenever I make a connection it takes about 10 secs. It's running on a P1900 with 1gb Ram so no reason there for slowness. Once I'm connected the queries work pretty much instantanously but to connect using SQLPLUS, Toad, ODBC, OLEDB all take about 10 secs. I connect using OLEDB from Visual Basic development environment & after the 1st connection...
2
5608
by: Demetris | last post by:
Hello there. I have ORACLE 8.1.7.4 server on AIX 5.1. I have another server (BIZTALK) with Oracle client 8.1.7. The system is running ok. I can connect from the client on my database server just fine. However at certain stages we get the error below when it tries to open a connection.Please note that we are loading 150,000 records currently and we open / close a connection for every call. ORA-12154: TNS:could not resolve service name
5
102528
by: SerGioGio | last post by:
Hello, I am going nuts. I am trying to connect to my local ORACLE instance using ODBC. It used to work few weeks ago, but it fails now. Connection with: - SQL*plus: connection works! - DataDirect 5.0 Oracle Wire protocol (3rd party ODBC driver): connection works when I hit the driver's "test connection"
1
4713
by: Cliff Cooley | last post by:
Can anybody suggest what may be causing the following problem ? I have an ASP script that opens a connection to an Oracle database using a DSN connection string, such as : Set dbConn= Server.CreateObject("ADODB.Connection") dbConn.Open "DSN=somedsn; UID=someuser; PWD=somepassword" With the ASP running on an IIS 5 server, using the Oracle 8 driver to connect to an Oracle 9 database, there are no connection problems, and
9
17020
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC connect string and I am hoping that is my whole problem. I am trying to connect to an Oracle 9...
0
5771
by: ʹÃûÑï | last post by:
ORA-03114: not connected to ORACLE && MS's Bug?? DataBase:Oracle 817 using OracleClient,net framework 1.1 I'm using ADO.Net in C# with Oracle 817. and following is my public data access class. using System.Data.OracleClient;
0
1700
by: Anonymous User | last post by:
Hi, I am working on a mobile application that consists of a number of handheld scanners, an Xml Web service and an Oracle 9i database in a highly secure environment. The .Net Compact Framework application running on the scanners executes Web service methods, which in turn execute Oracle database functions. The Web service and the Oracle database are running on separate servers. The Web service uses the Microsoft OLE DB driver for Oracle....
7
20319
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables, if they do not already exist. In terms of ASP/ADO, that would be fine in a SQL Server Sense by a simply ASP/Server-Side JavaScript as such: var cnTemp = Server.CreateObject("ADODB.Connection");
17
5940
by: kanishka1213 | last post by:
when i run perl script in the cmd prompt , it runs well and outputs results from db. but when i run the same script on apache server internet explorer. i get an error as ----- install_driver(Oracle) failed: Can't load 'C:/perl/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at C:/perl/lib/DynaLoader.pm line 202. at (eval 5) line 3 Compilation failed in require at (eval 5) line 3....
0
8366
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.