Solved

Is there a way to check if thepartcular DB is started using Win APIs?

Posted on 2008-10-22
6
218 Views
Last Modified: 2015-01-05
I need to  check if the partcular DB is started using VC++> and the database that i have created is in SQL  Server 2005.
Please help with the code.

Thanks in advance.
0
Comment
Question by:madhav_119
[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
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22818303
Define "db is started"?  Do you mean the SQL Server engine or a particular database?
0
 

Author Comment

by:madhav_119
ID: 22829402
I guess starting SQL server engine includes starting all the databases also..It would be great if you can tell me the way to check both. SQL Server Engine (i think here you check if MSSQLSERVER service is started) and particular DB.

Thanks
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22830792
Are you looking to test the connection to the local machine that you are running on, or a remote machine?
0
 

Author Comment

by:madhav_119
ID: 22838064
On both. Local and remote
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 125 total points
ID: 22840579
Well I would say that the best way would be to test a connection to the DB, not to the service.

In your app, just create a connection test method that creates a connection to the server with a low connection timeout (like 5 seconds).
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

627 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