J
Jac
Hey,
How can I test if there is an connection-exception when using database
application block from the enterprise service?
I stopped the sqlserver.
I do now the following :
Database db = null;
IDataReader reader = null;
try
{
db = DatabaseFactory.CreateDatabase("Logging");
}
catch (Exception ex)
{
string e = ex.Message;
}
string sqlQuery = "SELECT * FROM log";
try
{
reader = db.ExecuteReader(CommandType.Text, sqlQuery);
}
catch (Exception ex)
{
string e1 = ex.Message;
}
It is only in the second catch that I receive an error.
But just in case of connection problems I want to try it (the
executereader) again after a few seconds.
I receive an SQLException : but how can I see that it is an connection
problem?
And how can I test this when I change my connection to an oracle
database without changing my code in the catch block.
I just need to know there is an connectionproblem independant of which
database (oracle or SQL) I used so I can take actions.
Thanks in advance,
jac
How can I test if there is an connection-exception when using database
application block from the enterprise service?
I stopped the sqlserver.
I do now the following :
Database db = null;
IDataReader reader = null;
try
{
db = DatabaseFactory.CreateDatabase("Logging");
}
catch (Exception ex)
{
string e = ex.Message;
}
string sqlQuery = "SELECT * FROM log";
try
{
reader = db.ExecuteReader(CommandType.Text, sqlQuery);
}
catch (Exception ex)
{
string e1 = ex.Message;
}
It is only in the second catch that I receive an error.
But just in case of connection problems I want to try it (the
executereader) again after a few seconds.
I receive an SQLException : but how can I see that it is an connection
problem?
And how can I test this when I change my connection to an oracle
database without changing my code in the catch block.
I just need to know there is an connectionproblem independant of which
database (oracle or SQL) I used so I can take actions.
Thanks in advance,
jac