Database Access with Visual Basic .NET (3rd Edition)
Running a true database server is a significant departure from sharing a Microsoft Jet database file. You have new concepts to learn and new things to worry about. However, SQL Server 2000 is much easier to set up and maintain than previous versions, especially version 6.5 and earlier. In this section we get you started with the minimum required to get a database up and running under SQL Server 2000, which actually comes in several different editions:
Determining Installation Requirements for SQL Server 2000
To install SQL Server 2000, Microsoft says that you'll need a Pentium (or compatible) processor running at a minimum of 166 MHZ, 95 to 270 MB of hard disk space (250 MB typical, 44 MB for the Desktop Engine), a CD-ROM drive, Internet Explorer 5.0 or later, and a supported operating system. The memory (RAM) requirements are as follows:
If you've actually tried to run SQL Server on a 166 MHZ processor with 64 MB of memory, please try to stop laughing and resume reading now. These specifications are minimum requirements. SQL Server may very well run on a machine this anemic, but in the real world the minimum requirement is the biggest, baddest computer you can realistically afford. It is supposed to be the computer that runs your entire business; scrimping on the hardware will only cause you grief later. If there's one area you want to consider maxing out on your computer, it's memory. In practice, if you have a limited budget, you are usually better off investing in additional memory than in additional CPU speed. A modest memory upgrade can go a long way in improving your system's performance. Note Because this book is designed to be a survey of database-oriented solutions in VB.NET, we don't explore every SQL Server feature. The SQL Books Online documentation that comes with SQL Server is the best source for this detailed information. If you're looking for a book that is more tutorial in nature, check out Microsoft SQL Server 2000 DBA Survival Guide by Spenik and Sledge (Sams Publishing).
Installing SQL Server 2000
After you've designated a computer for use with SQL Server, you can proceed with installation. It is fairly straightforward, with a few minor exceptions.
We can't help you with the fact that it takes a long time, but we can give you some pointers about the questions posed by SQL Server's setup application. In general, and certainly for simple developmental configurations, you should accept the default options that are offered by the dialog pages of the setup wizard. The following comments refer to the dialogs that require a bit more thought. In the Setup Type dialog box shown in Figure 3.1, you get to choose among typical, minimum, and custom setups, as well as the paths to the folders for the SQL Server programs and data files. Be sure that you have enough disk space on the drive where you store the data files and that they are on a path that is regularly backed up. Figure 3.1. Setup Type dialog box of the SQL Server Installation WizardIn the Services Accounts dialog shown in Figure 3.2, the default is a Domain User account, but you may want to use the Local System account if you aren't on a domain or have your own dedicated development server machine. On this dialog page you can determine whether SQL Server should start automatically when Windows is started. If you select this option, bear in mind that SQL Server will be started as a service from Windows. Services Accounts act as if they're part of the operating system; they don't appear in the Task Manager, and they can't be shut down like normal applications can. In the next section we give more information on how to manage a service running under Windows, but you might also see the Controlling the Way SQL Server Starts Up section later in this chapter. Figure 3.2. Services Accounts dialog box of the SQL Server Installation WizardFor a production server, it is preferable to use the default Windows Authentication Mode shown in Figure 3.3. This mode takes advantage of the existing Windows NT/2000 user account and security mechanisms. When an attempt to connect to the SQL Server is made, it uses the user's account information to authenticate her and, if the user (or her group) has been granted access to the SQL Server, she is in. This approach is simple and provides a single location for managing user accounts and groups. Figure 3.3. Authentication Mode dialog box of the SQL Server Installation WizardIn some situations it may be necessary to use Mixed Mode. In addition to enabling Windows Authentication, Mixed Mode also allows SQL Server Authentication. The latter requires the definition of user accounts within SQL Server, against which login attempts are tested. The main advantage of this mode is that it doesn't require a trusted connection between the server and the connecting workstation, making it the mode of choice if UNIX or Web clients are accessing the database. However, it does require additional work and redundant account management (Windows accounts and SQL Server accounts). Note Often, you will find it convenient to configure a development machine in Mixed Mode so that you can simply use the preinstalled sa (system administrator) account. Just be sure to develop a more robust and secure approach for your production machine at the very least, be sure to assign a good password to the sa account!
Starting and Stopping SQL Server with SQL Service Manager
The SQL Service Manager is used to start and stop SQL Server. You use it in situations where you need to take down the server to perform certain tasks, or if you just don't want to run SQL Server on a particular machine (on a development machine, for example). You don't have to stop SQL Server under normal circumstances, which goes along with SQL Server's role as an enterprise database system. The idea is that you're supposed to start it up and leave it running all the time, come heck or high water. Yet, in certain rare instances, you must stop the server to perform certain tasks, such as changing configuration options on the server or performing a hardware upgrade to the computer on which the server resides. When one of these situations comes up, use SQL Service Manager to take down SQL Server and bring it back up again. SQL Service Manager doesn't have to be running for SQL Server to do its work. The SQL Service Manager exists merely to give you control over the activation and deactivation of your server. After your server is in production mode, you probably won't often use SQL Service Manager. When you launch it (by selecting its icon in the SQL Server program group), SQL Service Manager looks like the window shown in Figure 3.4. Figure 3.4. SQL Service Manager in its pristine state, in which SQL Server is runningIf SQL Server is running, the status indicator is a green arrow; if it's not running, the indicator is a red square. To start SQL Server, click on the Start/Continue button; to stop it, click on the Stop button. It really is easier than making toast. Controlling the Way SQL Server Starts Up
After you set up SQL Server, the operating system automatically launches it when your server computer is started. Through the Services control panel, you can control whether SQL Server always starts when your computer starts. To view the current state of SQL Server and control how it runs when your computer is started, follow these steps.
If you just installed SQL Server on your machine, the MSSQLServer service status is Started and its start-up is Automatic. To stop the MSSQLServer service from the Services control pane:
Note Starting and stopping SQL Server by using the Services control panel is essentially the same as starting and stopping it from the SQL Service Manager, albeit less colorful.
|