Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Ivor Horton's Beginning Visual C++ 2005
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2005 by Ivor Horton; ISBN: 9780764571978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 28th, 2006, 07:44 AM
Authorized User
 
Join Date: May 2006
Location: Iver, Bucks., United Kingdom.
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Express installation; Page 931; Ch 19

Installing SQL database, using the free SQL SERVER 2005 Express edition.

This has caused me a lot of problems, basically because I have used SQL Server before; do not have Microsoft Access and did not know what to expect from SQL Server. Assuming that others may have similar problems, I thought that I would write down, as best I could, the process to follow as it took me a full day of experimentation to sort out.

(Note SQL SERVER 2005 Express edition is a free download from Microsoft! It has limitations, listed on http://www.microsoft.com/sql/prodinf...-features.mspx but is not time-limited and hopefully, as Ivor Horton identifies it, will be adequate for the relevant chapters of his book.)

First of all, two brief notes: Figure 19-6 shows the ODBC Data Source Administrator. For XP pro SP2, if not others, this is not in the CONTROL PANELS, but is in ALL PROGRAMS/ ADMINISTRATIVE TOOLS/ DATA SOURCES (ODBC).

Secondly, there is a slight difference in Figure 19-12, as described at the end of this text.

Process:

1) Find files
2) Install SQL Server 2005 Express edition
3) Install SQL Server Management Studio Express
4) Extract Northwind files
5) Install Northwind via SQL Server Management Studio Express
6) Register in Data Sources (ODBC)
7) Quick check on Northwind database
8) Continue in book from Generating an MFC ODBC Program, page 933, Chapter 19


1) Find files

The files required take about 100MB and then, once installed, they occupy about 600MB.

Three files are required:
a) SQL Server 2005 Express edition
Find via msdn.microsoft.com/vstudio/express/sql/default.aspx.
Downloads are on msdn.microsoft.com/vstudio/express/sql/download/ for which you need two items from part 3.
(The first item is 'Microsoft SQL Server 2005 Express Edition')

The file name is: SQLEXPR.EXE and it is 53.8 MB to download.

b) The second file is SQL Server Management Studio Express and is listed just below that the server download.
The file name is: SQLServer2005_SSMSEE.msi and it takes 38.5 MB.

c) The third file is Northwind. Go to msdn2.microsoft.com/en-us/library/ms227484.aspx, where there are the installation instructions for Northwind.

To find the file itself:
  Copy and paste 'SQL2000SampleDb.msi' into the search box.
  Select the search button.
  Look for result 'Installing Sample Databases for Express Editions' and Select link.
  Select link against 'Northwind and pubs 'labelled 'Microsoft Web Site'
  Finally you get to the download. (There are easier ways, I am sure, but hopefully this will get you there!)


The file name is SQL2000SampleDb.msi and it takes about 1.5MB

===================================

2) Install SQL Server 2005 Express edition

Select and run SQLEXPR.EXE.

Follow the set up instructions, selecting the 'next' button. The following apply once you reach the Microsoft SQL Server 2005 Setup: System Configuration Check: Expect all of these to be successful. You may notice that a Help button appears at the bottom left hand corner of the dialog. The contents include Installing SQL Server Express, if there are problems, variations required or an understanding of options presented.

Registration Information: Enter name and company. Leave 'Hide Advanced Configurations Options' ticked.

Feature Selection: I enabled the Client Components as well as the default of the Database Services.

Authentification Mode: Select Windows Authentification Mode.

Error and Usage Report Settings: Your choice.

Ready to Install: Select Install. Wait several minutes. 'Next' button becomes active once completed and all products have a status of 'Setup finished.'

Completing Microsoft SQL Server 2005 Setup: A summary log is available, if required. Otherwise, select the Finish button.


If you look at ALL PROGRAMS/MICROSOFT SQL SERVER 2005/ you will find a folder called Configuration Tools with three tools enclosed including SQL Server Configuration Manager, SQL Server Error and Usage Reporting and SQL Server Surface Area Configuration.

Select SQL Server Configuration Manager. In the left hand column, select SQL Server 2005 Services. SQL SERVER (SQLEXPRESS) should be shown as running, whereas SQL SERVER BROWSER will be shown as stopped. Close the SQL Server Configuration Manager.

Note: You may need to reboot to start the server.

(An alternative way to see if it is running can be performed by pressing CTRL-OPTION-DELETE; Select TASK MANAGER and then PROCESSES tab. Select Image Name, in order to set the names in alphabetical order, and look for sqlserver.exe.)


===================================

3) Install SQL Server Management Studio Express


Select and run SQLServer2005_SSMSEE.msi.

This appears to be straight foward following the next and finish buttons.


===================================

4) Extract Northwind files

Select and run SQL2000SampleDb.msi. This will extract the following files into C:\SQL Server 2000 Sample Databases:

instnwnd.sql
NORTHWND.LDF
NORTHWND.MDF
instpubs.sql
PUBS.MDF
PUBS_LOG.LDF
ReadMe_SQL2000SampleDbScripts.htm

The 'pubs' files are for a second sample database, but are probably not used in the book.

===================================

5) Install Northwind via SQL Server Management Studio Express


Select ALL PROGRAMS/ MICROSOFT SQL SERVER 2005/ SQL SERVER MANAGEMENT STUDIO EXPRESS.

In SQL Server Management Studio Express, select FILE/ OPEN/ File... and select 'instnwnd.sql' from C:\SQL Server 2000 Sample Databases.

The script will be displayed together with the 'Connect to Database Engine' login at the front.
The login dialog should identify your ODBC Server Name (MY_LAPTOP\SQLEXPRESS in my case) and have Windows
Authentication against 'Authentification.' Select the 'Connect' button.

(If the server name is not shown, click the cancel button and a window will be displayed indicating 'No Server
Connection.' Select VIEW/ REGISTERED SERVERS and a list of the names of registered servers will be displayed.)

Once logged in and the script for 'instnwnd.sql' displayed, select 'QUERY/ EXECUTE' (or Select the '! Execute' button)

When completed, a message should be displayed in the bottom left hand corner of the messages window 'Query completed successfully.'

Under TOOLS select 'Open Server in Object Explorer'.


===================================

6) Register in Data Sources (ODBC)

Go to ALL PROGRAMS/ ADMINISTRATIVE TOOLS/ DATA SOURCES (ODBC), which brings up the 'ODBC Data Sources Administrator' dialog
Select Add button to open 'Create New Data Sources' dialog.
Select 'SQL Native Client' followed by Finish button.
A new window opens with 'Create New Data Sources to SQL Server.' Enter Northwind into Name box. Into the Server box you need to enter the full name as noted in SQL Server Management Studio Express. For me it is MY_LAPTOP\SQLEXPRESS.
Select the 'Next' button, which brings up a new version of the 'Create New Data Sources to SQL Server' window.
Use 'With Integrated Windows Authentication', if not already selected and select the 'Next' button.

Next window has a box and tick box called 'Change the default database.' Select the tick box and use the drop down menu to select Northwind. Leave Mirror and Attach Databse Filename empty. I have selected the 'Use ANSI quote identifiers' and 'Use ANSI nulls, paddings and warnings' although I am not sure whether I should have done or not! (Hence I may come back and change this later, if necessary.)

Select the 'Next' button. In this window, only the 'Perform Translation for character data' is selected, by default.
Select 'Finish' button and a new window comes up listing the settings. If you select the 'Test Data Sources' button, hopefully it will bring up a new window which includes the words 'TESTS COMPLETED SUCCESSFULLY.'
Select the OK button and now you should be back with the 'ODBC Data Sources Administrator' dialog, this time including Northwind in the list of data sources.

===================================

7) Quick check on Northwind database

With SQL Server Management Studio Express running, Select VIEW/OBJECT EXPLORER. There should be a list of folders including: Databases, Security, Server Options, replication, Management.
Open the Databases folder, where there will be two databases: System Databases and Northwind. Select Northwind; Select Tables. Folder should open with a long list of tables (Categories, CustomerCustomerDemo ... Territories) and all of mine start with 'dbo.' -i.e. dbo.Categories, dbo.CustomerCustomerDemo ... dbo.Territories.


Select 'FILE/ NEW/ QUERY WITH CURRENT CONNECTION CTRL+N'
Enter the following (note case sensitive): SELECT * FROM Northwind.dbo.Products;
Select 'QUERY/ EXECUTE' (or Select the '! Execute' button)
The Results window should open with a long list of results. (If your list does not include the 'dbo.' you may have to remove it from the query line above.

Below is a listing of the first few lines (77 in all) I obtained as returned from the above query.

  Product ID Product Name.......
  1 Chai 1 1 10 boxes x 20 bags 18.00 39 0
  2 Chang 1 1 24 - 12 oz bottles 19.00 17 40
  3 Aniseed Syrup 1 2 12 - 550 ml bottles 10.00 13 70
  4 Chef Anton's Cajun Seasoning 2 2 48 - 6 oz jars 22.00 53 0


8) Continue in book from Generating an MFC ODBC Program, page 933, Chapter 19

As the step says... (although read 931/933 in case I have missed something!)


Finally, Figure 19-12 comes out slightly differently with SQL Server 2005 Express. Separating Tables and the sub-objects is another folder, with an icon in the shape of a side view of a head, labelled 'dbo'.


                 ===================


  #2 (permalink)  
Old July 31st, 2006, 12:13 AM
Authorized User
 
Join Date: May 2006
Location: Iver, Bucks., United Kingdom.
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A couple of comments after going through the chapter, wrt using SQL Server 2005 Express.

a) 'dbo' and '[dbo].' do not need to be added to the SQL access codes shown in the book.

b) The code at the bottom of page 937 is for an ACCESS database. With SQL Server 2005 Express the code becomes:

return _T("
DSN=Northwind;
Trusted_Connection=Yes;
APP=Microsoft\x00ae Visual Studio\x00ae 2005;
WSID=MY_LAPTOP;
DATABASE=Northwind;");

Interestingly, the ACCESS code still extracts the data from the database perfectly well.


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Express & Ch 20 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 1 August 2nd, 2007 05:16 PM
Ch 19 not working either... resolutions BOOK: Beginning JavaServer Pages 6 May 17th, 2007 04:36 AM
SQL Express OK in Ch 22 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 August 4th, 2006 01:34 PM
Page 975; Ch 19 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 31st, 2006 12:25 AM
Page 973; Ch 19 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 July 31st, 2006 12:17 AM



All times are GMT -4. The time now is 09:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.