Solved

Checking Database Connection

Posted on 2006-11-02
2
225 Views
Last Modified: 2010-04-16
I have an application that connects with a database inside our firewall.  When the application starts, I want to check to see if the user can connect to the database and shutdown cleanly if not.

Is the best way to check if the user can connect just doing an open and close on the db and see if it fails?  Or is there a better way?

Thanks,
Christie
0
Comment
Question by:muellerfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 125 total points
ID: 17860823
As you have already suggested you should just wrap your database connection in a try..catch block and handle the SqlException raised if/when the connection fails.
0
 
LVL 1

Author Comment

by:muellerfan
ID: 17862321
Thanks for confirming my thoughts!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to repeat the data 4 43
Unlocking a column in excel using C# 17 33
How to reference a column by name when iterating through a GridView ? 1 49
aspx ascx, c# 7 42
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question