473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Enterprise Library dataacess testing connection and trap it

Hey,

How can I test if there is an connection-exception when using database
application block from the enterprise service?
Because when the database is not running, I have to do some actions. SO, I need to know is there is an connectionproblem.
I find so less information.

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
Jan 12 '07 #1
0 775

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mike Chamberlain | last post by:
Hi all. I'm trying to extend the Microsoft Enterprise Library Data Access Application Block (http://msdn.microsoft.com/library/en-us/dnpag2/html/daab.asp?frame=true) to work with a Borland...
0
by: Mateusz [PEYN] Adamus | last post by:
Hi I have a Typed DataSet. I've databinded it to some text controls on my form, controls show data when I show record. But now I would like to create a new record with this form, controls...
7
by: galico | last post by:
Hi All, We are having a very strange problem with the above. We have designed an application in ASP.NET 2.0 that uses the enterprise library data application blocks amongst others. We seem to be...
1
by: Victor | last post by:
Hi guys I have a question here. I am currently using Enterprise Library Jan 2006 version. I found out where i execute the Database.executeDataSet() the Enterprise Library will not close the...
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I am trying to add multiple connection strings in my web.config file. I searched in google to find out how to add multiple connections strings through enterprise library 2.0 ,...
3
by: Rick Mavrovik | last post by:
Hi, I am developing web application on 3 tier model. For data access my Data Access Layer (DAL) uses MS Enterprise Library (MSEL). If I am right MSEL relies on web.config file for the connection...
1
by: AutoTrackerPlus | last post by:
I'm using the EL 2.0 library. I have a datalayer where I am debating doing 2 things... I'm concerned that because I am using a IDataReader, my connection to the database is never getting closed and...
2
by: =?Utf-8?B?TWlrZSBEb3Zlcg==?= | last post by:
Hi, How does one install the June 2005 Enterprise library (for .NET 1.1) on a production windows 2003 Internet server? My web project works in my dev environment as all installs properly there...
0
by: =?Utf-8?B?bmFzcmVlbg==?= | last post by:
Hi, One of my application (running in Asp.net 1.1) is accessing the registry HKEY_CLASSES_ROOT\DataAcess.DataAcess folder.Right now this application is running in Windows 2000 server without any...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.