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.

AccessDataPart2_01

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

AccessDataPart2_02

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.

AccessDataPart2_03

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.

AccessDataPart2_04

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.

AccessDataPart2_05

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:

AccessDataPart2_06

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.

AccessDataPart2_07

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 John@JohnMuellerBooks.com. 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 99 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 books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at http://blog.johnmuellerbooks.com/.

When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John@JohnMuellerBooks.com. John is also setting up a website at http://www.johnmuellerbooks.com/. Feel free to take a look and make suggestions on how he can improve it.