• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Checking Database Connection

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
muellerfan
Asked:
muellerfan
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
muellerfanAuthor Commented:
Thanks for confirming my thoughts!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now