Checking SQL Server Status

This is an update of a post that originally appeared on November 14, 2012.

A number of my books rely on database access. Today that database access can take many forms, such as the use of .csv files in my AI, machine learning, and deep learning books. However, this post is specific to those books that use Microsoft’s SQL Server on the local system, which is currently limited to C++ All-In-One for Dummies, 4th Edition (optionally) and C# 10.0 All-in-One for Dummies, but could include other books in the future (or you may simply decide to use Microsoft SQL Server with one of my other books).

In order to access any server, the server must be running. It only makes sense that you can’t access something that isn’t listening. The problem is that SQL Server may not start automatically for a number of reasons on your system and that Visual Studio doesn’t always make it apparent that the server isn’t running. You may get a nebulous message when you try to make a connection that doesn’t tell you anything. (No, SQL Server doesn’t start automatically when you make a request for data.) With this in mind, a post of checking the status of SQL Server is important.

Normally, I would tell you to use the tools that come with SQL Server to check the status of the server. However, some versions of SQL Server Express Edition install without the standard tools now, such as SQL Server Management Studio (SSMS). Without access to these tools, it may seem as if checking the server status is impossible. Fortunately, you have other options.

The best way to check the status of SQL Server on your system is to use the Services console found in the Administrative Tools folder of the Control Panel. The Services console is one of a number of Microsoft Management Console (MMC) snap-ins that Windows installs automatically for you. However, to use this console, you must have administrator rights on the target system. Without these rights, you truly are out of luck in checking the status of your SQL Server setup and will need to get an administrator to help you.

Open the Services console by right clicking Start, choosing Run from the menu, typing services.msc in the Open field, and clicking OK. You find a list of all of the services installed on your system in the resulting Services window. Scroll down the list and you should find one or more SQL Server entries like the ones shown here.

The services window contains a list of Windows services installed on the local machine that their status.
Use the Services console to check the status of services on your system.

In order to work successfully with the examples in my book, you should have SQL Server set to start automatically. In addition, when you check the service, you should see Started in the Status column as shown in the screenshot. If you don’t see Started, then highlight the service as shown and click the Start link you see on the left side (not shown in this case because the service is already started).

To make the examples easier to work with, you should also ensure that the SQL Server Browser service is started. This service makes it possible for Visual Studio to find the SQL Server installation on your system. Without this service, you must correctly type the name of the SQL Server installation you want to use when creating a connection, which is both time consuming and error prone.

If you find that you encounter problems making database examples in my books work, please check the status of SQL Server to ensure the service is actually started. Contact me at [email protected] if you experience any other connectivity problems. I may not be able to fix every problem you encounter, but I often have a good idea of what problems you might be seeing on your system and will do my best to help you.

Windows XP and Advanced Command Line Utilities

Both Windows Command-Line Administration Instant Reference and Administering Windows Server 2008 Server Core contain a number of advanced commands, such as SetX, that don’t come with the operating system. A number of readers have written to ask about these commands and where they can get them. Fortunately, Microsoft makes it easy to get what you need by downloading and installing the Windows XP Service Pack 2 Support Tools.

The Support Tools site contains a list of the commands and utilities you get. Included in this list are two important MMC console configuration files (ADSIEdit.msc and SIDWalk.msc) that make management tasks considerably easier. There is an executable form of ADSIEdit, but Support Tools doesn’t include it and you can’t use ADSIEdit as a command line tool anyway. The SIDWalk utility comes in executable (.exe) form as well so that you can use it in batch files.

In order to install the Support Tools, you must provide 5 MB hard drive space. Of course, coming up with that small amount of space isn’t the problem it once was. You must also have Windows XP Service Pack 2 (or higher) installed.

 

Something that Microsoft doesn’t emphasize is that these tools don’t work with the 64-bit version of Windows XP. Unfortunately, I haven’t found a workaround for the problem. Utilities created for newer 64-bit versions of Windows, such as Windows 7, don’t appear to work with Windows XP. If someone has a solution to this problem, please let me know.

After you download Support Tools, you may have to add a new path to your Windows setup. You perform this task using the Environment Variables dialog box. Simply open the System Properties applet, select the Advanced tab, and click Environment Variables to access it. Make sure you add the path to your installation to the existing Path and don’t overwrite the existing path with the new information. (Highlight the Path entry in the System Variables list and click Edit to display the Edit System Variable dialog box.) In most cases, the Support Tools install to the %Program Files%\Support Tools folder, which means you’d type ;%Program Files%\Support Tools at the end of the existing Path environment variable.

I’ll provide updates to this post as needed. If you have any questions, please contact me at [email protected].