Solved

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

Posted on 2008-10-22
6
168 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
Comment Utility
Define "db is started"?  Do you mean the SQL Server engine or a particular database?
0
 

Author Comment

by:madhav_119
Comment Utility
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
Comment Utility
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
Comment Utility
On both. Local and remote
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 125 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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 Copy Database Wizard 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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

11 Experts available now in Live!

Get 1:1 Help Now