Solved

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

Posted on 2008-10-22
6
202 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 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server - Date Calc for 1st Day of Current Month for LAST YEAR? 3 46
sql help 8 58
How can i use WITH CTE for checking exist value? 3 47
SQL Improvement  ( Speed) 14 33
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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