Solved

Checking Database Connection

Posted on 2006-11-02
2
221 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
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 125 total points
Comment Utility
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
Comment Utility
Thanks for confirming my thoughts!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now