I'm just curious about how to recover from a network error or similar errors.
This
link better explain my problem, but it does not apply to Oracle DBs
Here is what I do:
I Have established a working connection to the database, and pooling is enabled
Everything works as it should, but when I pull my network cable I get an exception:
ORA-12571: TNS:packet writer failure
Here is my code:
{color:#0000ff}try
{
cmd.Prepare();
if (reader != null)
reader.Dispose();
reader = cmd.ExecuteReader(); // it is this call that throws the exception
reader.FetchSize = cmd.RowSize * 100;
}
catch (OracleException e)
{
String st = Connection.State.ToString();
throw e;
}{color}
Here is what I want to do:
In the catch part I would like to try and reconnect say 5 times before giving up
I can see that even though I've lost my network connection the Connection.State is set to open.
What is the best way of doing this, so that the application reconnects from within the catch?
Edited by: user10763840 on Jan 6, 2009 3:10 AM