Accessing Sample Database Data (Part 2)

In my previous post, Accessing Sample Database Data (Part 1), you learned about the various ways in which an author can provide database examples as part of a learning experience. This post is going to look at the process for gaining access to the database files in Windows, no matter what sort of database is used (including XML databases). In order to perform the tasks in this post, you need a copy of Windows Explorer opened with Administrator privileges. Choose Start | All Programs | Accessories to see the Windows Explorer shortcut. Right click the Windows Explorer shortcut and choose Run As Administrator from the context menu. Provide the requires credentials (username and password) to run in administrator mode, if asked.

Checking File Access

Some of the databases you obtain for my books appear on a CD or other device that provides read-only access. When you copy the files from the CD or other device to your hard drive, Windows keeps the files set to read-only access. In order to use the files, you must be able to read and write them. To change this setting, right click the folder that holds the files and choose Properties from the context menu. You see a properties dialog box similar to the one shown here.


Clear the Read-only checkbox and click OK. You’ll see a Confirm Attribute Changes dialog box like the one shown here.


Make sure the Apply Changes to this Folder, Subfolders and Files options is selected. Click OK. Windows will make all of the files read/write so that you can work with them. If you see a User Account Control (UAC) dialog box telling you that Administrator permission is required, click Continue and provide the required credentials (username and password) if required.

Checking Folder Security

It’s essential that you check folder security to avoid all sorts of weird problems that arise when you don’t have access. Never assume you actually have access; always check it to be sure. Right click the folder holding the files and choose Properties. You see the Properties dialog box again. This time select the Security tab as shown here.


Make sure that your account, or a group account to which you belong, is listed in the Group or User Names list as having Full Control (as shown in the Permissions list in the bottom half of the dialog box). If you don’t have the required access, click Edit. You’ll see a Permissions dialog box for the affected folder as shown here.


Verify that your name or a group of which you are a part appears in the Group or User Names list. If not, click Add. You’ll see a Select Users or Groups dialog box like the one shown here.


Type your login name or the name of the group that should have access to the folder. Click Check Names to ensure you typed the name correctly. If you didn’t type the name correctly, Windows will tell you it didn’t find the name and provide you with another dialog box for searching for the correct name. Otherwise, you’ll see the fully qualified name used to access the folder. Once you have a correct name in place, click OK. You’ll see the Permissions dialog box again.

Select the name you want to use to access the folder from the list. Check the Full Control option in the Allow column of the Permissions list at the lower half of the Permissions dialog box. Click OK. If everything goes correctly, you’ll see the Security tab of the Properties dialog box again, but this time it will contain your selected group with full control access.

Something odd can happen and it confuses a lot of readers. You might see a dialog box similar to this one during the security setting process:


When you see this dialog box, it usually means that the SQL Server service is running and it has the requested file open. Click Continue for each of the disallowed changes to ensure that your folder remains in a usable state.

Now, open the Services console found in the Administrative Tools folder of the Control Panel. Locate the SQL Server service and click the Stop link on the left side of the right pane to stop the service as shown here.


Try setting the security again. If the error persists, you need to try to set the security on the individual database files using the same technique you tried to use for the folder as a whole. (When working with individual files, the security tab may display a message saying you need administrative privileges to view the individual file security. Simply click Continue to work with the privileges.) Yes, it’s a nuisance setting individual file security, but that’s the way Windows works at times. After you successfully set security on each of the database files, remember to restart the services that you stopped.

A number of readers stumble on these file access and security permission issues. Please let me know if this post solves the problems for you. If not, make sure you send your questions to You see see the next post in this series at Accessing Sample Database Data (Part 3).


Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 117 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current offerings include topics on machine learning, AI, Android programming, and C++ programming. His technical editing skills have helped over more than 70 authors refine the content of their manuscripts. You can reach John on the Internet at