Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-22
6
Medium Priority
?
223 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
  • 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 500 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview

916 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