Tài liệu Module 9: SQL XML pptx

30 443 0
Tài liệu Module 9: SQL XML pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Contents Overview 1 Lesson: XML Support in SQL Server 2000 2 Lesson: Using HTTP to Access and Input XML Data 10 Lab 9: Creating SQL Queries Using XML 17 Review 22 Module 9: SQL XML Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, places or events is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.  2001 Microsoft Corporation. All rights reserved. Microsoft, MS-DOS, Windows, Windows NT, ActiveX, BackOffice, bCentral, BizTalk, FrontPage, MSDN, MSN, Netshow, PowerPoint, SharePoint, Visio, Visual Basic, Visual C++, Visual C#, Visual InterDev, Visual Studio, Windows Media, and Xbox are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Module 9: SQL XML iii Instructor Notes This module provides participants with an introduction to the use of Extensible Markup Language (XML) with Microsoft ® SQL Server ™ 2000. SQL Server 2000 is one of the Microsoft .NET Enterprise Servers. As such, it is an example of how all the .NET Enterprise Servers are changing to fully support XML technologies. This chapter will give participants an understanding of the diversity of XML support in SQL Server without overwhelming them. This is a complex topic and might not be easily understood by all participants at first. Make certain that participants know that this module covers a major topic and that there is an entire course devoted to it. That course is Course 2091A, Building XML-Enabled Applications Using Microsoft SQL Server 2000. After completing this module, participants will be able to: ! Describe how SQL Server 2000 uses XML. ! Describe how to implement XML support in SQL Server 2000. ! Write basic XML queries against SQL Server 2000 by using Hypertext Transfer Protocol (HTTP). ! Use a basic XML template against SQL Server 2000 to retrieve data. ! Insert data into SQL Server 2000 by using XML. ! Describe some of the XML features recently added to SQL Server 2000. Presentation: 30 Minutes Lab: 45 Minutes iv Module 9: SQL XML Materials and Preparation This section provides the materials and preparation tasks that you need to teach this module. To teach this module, you need the following materials: • Microsoft PowerPoint ® file 2500A_09.ppt To prepare for this module: ! Read all of the materials indicated for this module and complete all labs and practices. ! Read the topic “XML and Internet Support” in SQL Server 2000 Books Online. ! Familiarize yourself with Course 2091A, Building XML-Enabled Applications Using Microsoft SQL Server 2000. Note the differences between the XML support described in the course and the XML support in the XML for SQL Server 2000 add-in. Instructor Setup for a Lab This section provides setup instructions that are required to prepare the instructor computer or classroom configuration for a lab. ! Prepare for the lab 1. Be sure that Internet Information Services (IIS) is properly configured and working. 2. Be sure that Configure SQL XML Support in IIS is available in the Microsoft SQL Server program group menu. 3. Work through as many examples as you can in addition to the lab exercises, because the participants may ask questions about what else can be done with XML and SQL queries. According to the Manual Setup Guide, the SQL password is set to 2500. Required materials Preparation tasks Lab 9: Creating SQL Queries Usin g XML Note Module 9: SQL XML v Demonstration This section provides demonstration procedures that will not fit in the margin notes or are not appropriate for the student notes. ! Prepare for the demonstration 1. Be sure that you have read and practiced the steps required to successfully install XML support for IIS. 2. Be sure that you are familiar with the various properties pages for configuring a virtual directory. 3. Test the setup and configuration, and make sure that it will properly process a Uniform Resource Locator (URL) query and return the results to the browser properly. 4. If you discover any problems with the configuration, be sure to fix them before you give the demonstration, because it can be time consuming to resolve them. ! Set up the virtual directory in IIS to publish a SQL Server database 1. Click Start, point to All Programs, point to Microsoft SQL Server, and then click Configure SQL XML Support in IIS. 2. Expand your server, right-click Default Web Site, point to New, and then click Virtual Directory. 3. In the New Virtual Directory Properties dialog box, on the General tab, make Nwind09 the value for the Virtual Directory Name setting. 4. Click Browse, browse to \Inetpub\wwwroot\ to select the local path, and then click Make New Folder. 5. Type NwindSite and then click OK. 6. On the Security tab, select Use Windows Integrated Authentication. 7. On the Data Source tab, use the following settings and values. Setting Value SQL Server (local) Database Northwind 8. On the Settings tab, select all the check boxes so that all query types are allowed. Setting up XML in SQL Server 2000 vi Module 9: SQL XML ! Set up the schema and template virtual names on IIS 1. Open Microsoft Windows ® Explorer, and then navigate to the \Inetpub\wwwroot\NwindSite folder. 2. Create a new folder named templates and another new folder named schemas. 3. In the New Virtual Directory Properties dialog box, on the Virtual Names tab, click New to create the virtual name for the template. 4. In the Virtual Name Configuration dialog box, in the Virtual name box, type template09 5. In the Type list, click template. 6. Click the ellipsis button (…), browse to the \Inetpub\wwroot\NwindSite\templates folder, and then click OK. 7. In the Virtual Name Configuration dialog box, click Save. 8. Repeat steps 3 through 7. Use schema09 for the virtual name, schema for the type, and browse to the schemas folder. 9. Close the New Virtual Directory Properties dialog box. 10. Close the IIS Virtual Directory Management for SQL Server console. ! Prepare for the demonstration 1. Read the documentation on the XML View Mapper and familiarize yourself with its architecture, purpose, and functionality. 2. Practice the tutorial carefully more than once. 3. To present this demonstration, use the tutorial to show how the XML View Mapper works. The steps are not reproduced here. You might want to print out the tutorial section of the XML View Mapper documentation. The XML View Mapper Module 9: SQL XML vii Module Strategy This module represents a wide range of topics. In many ways, it does not cover them sufficiently. That is why there is a full course on this topic, which is now partially out of date due to the XML for SQL Server 2000 add-in. Stress that this is strictly an overview of the topic, which is consistent with the overall nature of this course as an introduction. Use the following strategy to present this module: ! XML Support in SQL Server 2000 This lesson gives the reasons for having XML support in SQL Server 2000 and the major capabilities of XML support in SQL Server 2000. ! Using HTTP to Access and Input XML Data This lesson describes the power of using XML and SQL in queries through Hypertext Transfer Protocol (HTTP) access to SQL Server. Be ready to explain why this capability is interesting and useful. Discuss the security risk of allowing direct URL queries. One risk is that URL queries expose database structure. Another risk is that identity of the issuer of the request may not be known. For these reasons, limit the use of URL queries. Contrast allowing direct URL queries with using XML Path Language (XPath) and XML Schema Definitions (XSD) schemas. This approach has an important security advantage over allowing URL queries. Template files enhance security by hiding details of the database schema from the end user. The following lessons are included in Appendix C. ! FOR XML and OpenXML In this lesson, you see two methods of querying SQL Server 2000 by using tools available through the XML for SQL Server 2000 add-in. ! Manipulating XML Using Transact-SQL This lesson shows participants how Transact-SQL and XML are useful and powerful when used together. This can take up a lot of the module time, so move through it briskly. ! Retrieving XML Data with ADO and ADO.NET This lesson is a quick overview. The topic is too large for this course, and there is not time to cover the topic in more depth. If you have time and are able to, elaborate on the evolution from ADO to ADO.NET. Be prepared for questions, and be ready to provide examples. Remind participants that there is an ADO.NET course. ! Using Mapping Schemas Explain why mapping is useful and how it fits in with other products and technologies, particularly Microsoft BizTalk ™ Server 2000. Emphasize the importance of graphical tools like BizTalk Server. Also, emphasize that tools like BizTalk Server are new and will become more sophisticated and friendly for the developer and user. Appendix viii Module 9: SQL XML ! Updategrams and Bulk Load Updategrams and the Bulk Load utility are relatively straightforward, but be sure to explain why they are needed. Because this topic can be slightly confusing, be prepared to give additional examples or to elaborate on the ones provided. Read the background materials on these topics. ! Ideas and Future of XML and SQL The purpose of this topic is to emphasize that SQL XML is developing rapidly. The map example shows a different way to use XML and SQL Server together. Stress that Microsoft is enhancing XML support in SQL Server. The speed of the evolution of the Internet and the development of .NET caused Microsoft to release the XML for SQL Server 2000 add-in, rather than wait for an entire product cycle. Check the SQL Server site and the Microsoft MSDN ® SQL Server site before each class to see if any new XML and SQL enhancements or product add-ins are announced. Module 9: SQL XML 1 Overview ! XML Support in SQL Server 2000 ! Using HTTP to Access and Input XML Data ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** Microsoft ® SQL Server ™ 2000 plays a crucial role in the Microsoft .NET strategy as a means of enabling the easy use of data with Extensible Markup Language (XML) technologies. This module presents a detailed overview of the implementation of XML in SQL Server 2000 and add-ins to the product since its release in 2000. Key points are covered here for your understanding. In-depth coverage of these topics is available in related SQL Server and Microsoft Visual Studio ® courses. After completing this module, you will be able to: ! Describe how SQL Server 2000 uses XML. ! Describe how to implement XML support in SQL Server 2000. ! Write basic XML queries against SQL Server 2000 by using Hypertext Transfer Protocol (HTTP). ! Use a basic XML template against SQL Server 2000 to retrieve data. ! Insert data into SQL Server 2000 by using XML. ! Describe some of the XML features recently added to SQL Server 2000. For in-depth coverage of the implementation of XML in SQL Server 2000, see Course 2091A, Building XML-Enabled Applications Using Microsoft SQL Server 2000. In this module, you will use SQL Query Analyzer to connect to the Northwind database. To do this, you need the SQL password. According to the Manual Setup Guide, the SQL password is set to 2500. Introduction Objectives Im portant 2 Module 9: SQL XML Lesson: XML Support in SQL Server 2000 ! XML Features in SQL Server 2000 ! SQL Server XML Architecture ! XML for SQL Server 2000 ***************************** ILLEGAL FOR NON - TRAINER USE ****************************** While developing SQL Server 2000, Microsoft determined that the use of XML for Internet-based work was a major requirement. This lesson describes the XML support incorporated in the product. Just as XML technologies are changing rapidly, so too are the XML technologies in SQL Server. The normal development cycle of three to four years is too long, so interim releases of new XML support in SQL Server are being provided through add-in features. You will learn about some of these in this lesson. After completing this lesson, you will be able to: ! Describe key XML features supported in SQL Server 2000. ! Describe the architectural features providing XML support in SQL Server 2000. ! Identify and describe features added to SQL Server 2000 for XML support. ! Explain the range of ways in which SQL Server 2000 provides support for XML in general and for Microsoft .NET in particular. Introduction Lesson objectives [...]... provide the enhanced capabilities for XML support, the Microsoft OLE DB Provider for SQL Server (SQLOLEDB) has new properties that enable you to handle streams with XML data Module 9: SQL XML 5 SQL Server XML Architecture ! SQL Server ! Analysis Server Tier 1 Tier 2 Tier 3 SQL Database Northwind IIS and ISAPI SQLOLEB Schemas Sqlxml.dll Templates SQL Server 2000 FOR XML OPENXML *****************************ILLEGAL... file, it is represented in the following way: SELECT top 2 * FROM [Order Details] WHERE UnitPrice < 16 FOR XML AUTO < /sql: query> Module 9: SQL XML 17 Lab 9: Creating SQL Queries Using XML ! Exercise 1: Configuring SQL XML Support in IIS ! Exercise 2: Creating and Using SQL XML Queries *****************************ILLEGAL FOR... Management for SQL Server Utility” and “Accessing SQL Server Using HTTP” in SQL Server Books Online Scenario You want to enable XML support in SQL Server 2000 so that you can run URL queries against SQL Server 2000 databases with XML documents, data, and techniques Estimated time to complete this lab: 20 minutes 18 Module 9: SQL XML Exercise 1 Configuring SQL XML Support in IIS To work with XML in SQL Server... can communicate with IIS 6 Module 9: SQL XML XML for SQL Server 2000 Features of Web Release 1 Updategrams Features of XML for SQL Server 2000 XML Views with XSD annotated schemas Bulk Load XML rowset formatting on the client Sql: datatype An upgraded SQLOLEDB provider Dbobject queries formalized Enhanced Dbobject query capability IsXML NET Framework support – SQLXML Managed Classes and DiffGrams Template... improvements SQL Server 2000 users can use client-side XML functionality to move XML processing to the middle tier for better scalability or to wrap SQL Server Stored Procedures with the Transact -SQL FOR XML clause SQLXML 2.0 also introduces a set of SQLXML Managed Classes that allows NET developers to access SQLXML functionality Documentation There is extensive documentation with XML for SQL Server... using templates directly: http://IISName/virtualroot/?template= SELECT +FOR +XML+ mode Using real names, this becomes: http://bandicoot/nwind?template= SELECT+*+FROM+Customers+FOR +XML+ AUTO< /sql: query> ! For a query using a template file reference: http://IISName/virtualroot/TemplateVirtualName/.. .Module 9: SQL XML 3 XML Features in SQL Server 2000 ! HTTP access to SQL Server ! XML Views ! XSD and XPath support for queries ! Retrieve and write XML data " FOR XML clause " OPENXML rowset provider ! Stream support through enhancements to SQLOLEDB ! XML for SQL Server 2000 *****************************ILLEGAL FOR NON-TRAINER USE******************************... Sqlisapi.dll Data passed from the URL over HTTP to IIS is processed through these mechanisms to Sqlxml.dll through the SQLOLEDB provider The SQLOLEDB provider passes XML commands to Sqlxml.dll, which converts schema and XPath information into SQL commands that SQL Server can process SQL Server also processes the FOR XML clause and the OPENXML rowset provider so that it can communicate with IIS 6 Module. .. This documentation supplements the SQL Server Books Online material on XML support If you install XML for SQL Server 2000, it is particularly important to read the additional documentation, because it changes some of the original behavior of XML support in SQL Server 2000 Module 9: SQL XML 7 Practice: Using SQL Server XML Documentation ! In this practice, you will open SQL Server Books Online, search... Example Direct query to SQL Server http://bandicoot/nwind ?sql= SELECT+*+FROM +Employees+FOR +XML+ AUTO&root=root Query that references an XML schema http://bandicoot/nwind?template= SELECT+*+FROM+Employees+FOR +XML+ AUTO< /sql: query> Query that references a template file http://bandicoot/nwind/MyTemplates/mytemplate .xml Query that references . Lesson: XML Support in SQL Server 2000 2 Lesson: Using HTTP to Access and Input XML Data 10 Lab 9: Creating SQL Queries Using XML 17 Review 22 Module 9: SQL XML. data Enhanced SQLOLEDB Module 9: SQL XML 5 SQL Server XML Architecture ! SQL Server ! Analysis Server SQL Database Northwind IIS and ISAPI SQL Server 2000

Ngày đăng: 21/12/2013, 05:17

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan