SQLXML XML Technology For SQL Server Brian Moore Developer and Platform Strategy Group Microsoft Corporation.

Slides:



Advertisements
Similar presentations
Programming with ADO.NET By Sam Nasr April 27, 2004 Programming with ADO.NET By Sam Nasr April 27, 2004.
Advertisements

2/23/05 CS Advanced Databases 1 XML Support in SQL Server 2000 Sriram Krishnan Kevin Menard.
XML: Extensible Markup Language
Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Inside Data Access with SQLXML: Architecture Guide Rolandas Gricius MCT, MCSE, MCSD Adapted From.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 346 Day 25.
Copyright 2000, Microsoft Corp. SQL Server 2000 XML Annotated Schemata Michael Rys Program Manager SQLServer XML Technologies Microsoft Corporation
Objective In this session we will discuss about : What is ADO. NET ?
Module 9 Designing an XML Strategy. Module 9: Designing an XML Strategy Designing XML Storage Designing a Data Conversion Strategy Designing an XML Query.
SQL Server 2000 and XML Erik Veerman Consultant Intellinet Business Intelligence.
DAT304 Leveraging XML and HTTP with Sql Server Irwin Dolobowsky Program Manager Webdata Group.
Trends in Database Development: XML,.NET, WinFS Alexander Vaschillo Microsoft Alexander Vaschillo Microsoft.
2.2 SQL Server 2005 的 XML 支援功能. Overview XML Enhancements in SQL Server 2005 The xml Data Type Using XQuery.
XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
Copyright © 2014, 2015 William R. Vaughn All rights reserved William R. Vaughn.
ADO.NET – part II August 2004 [ Marmagna Desai]. CONTENTS ADO vs ADO.NET ADO.NET – Managed providers Connecting to Database SqlConnection Selecting Database.
XML in SQL Server Overview XML is a key part of any modern data environment It can be used to transmit data in a platform, application neutral form.
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Moving from Microsoft ® ADO 2.X To ADO.NET Jackie Goldstein Renaissance Computer Systems Ltd. MSDN Regional Director, Israel Prerequisites.
DAT 330 Building Web Services with SQL Server and SQLXML 3.0 Alexander Vaschillo Lead Program Manager WebData XML Group Microsoft Corporation.
5/24/01 Leveraging SQL Server 2000 in ColdFusion Applications December 9, 2003 Chris Lomvardias SRA International
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Designing a Scalable Enterprise Project Management Architecture Ken Toole Platform Test Manager MS Project Microsoft Corporation.
SQL Reporting Services From a Developers Perspective Adam Calderon Principal Engineer Interknowlogy LLC
Module 18 Querying XML Data in SQL Server® 2008 R2.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Retrieving XML Data from SQL server.  Using the FOR XML Clause to Retrieve Data Retrieving Data in XML Format How SQL Server Generates XML Using the.
SQLXML 의 세부 기능 소개 정 홍주 WebTime Feelanet. 목차  Updategram  Differgram  Bulk Load  Using Mapping Schemas  URL 을 통한 HTTP Access  Optimizing SQLXML Performance.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Database Farming For Improved Performance Presented By: Russell Yong Supervisor: Prof Wentworth.
Why ADO.NET Not your father’s Data Access.
DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems
1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd
Understanding Databases Lesson 6. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Relational Database Concepts Understand relational.
Chapter 14 1 Chapter 14 Storing and Retrieving XML in SQL Server 2000 November 6, 2001 Sook-Kyo Kwon.
Developing SQL Server 2000 Reporting Services Applications Brian Welcker Group Program Manager SQL Server Reporting Services Microsoft Corporation.
Session 1 Module 1: Introduction to Data Integrity
Module 3: Using XML. Overview Retrieving XML by Using FOR XML Shredding XML by Using OPENXML Introducing XQuery Using the xml Data Type.
DAT 405 Extreme SqlXml Irwin Dolobowsky Program Manager – SqlXml Microsoft Corporation.
Introduction Because database applications today reside in a complicated environment, various standards have been developed for accessing database servers.
DAT200 Microsoft® ADO.NET for ADO Classic Developers: Introducing ADO.NET Jackie Goldstein Renaissance Computer Systems
Introduction to.NET Building.NET Applications Mike Taulty Developer & Platform Group Microsoft Ltd
Dev399 SQLXML: XML Views and Relational Data Irwin Dolobowsky Program Manager Webdata Group Microsoft Corporation.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
 CONACT UC:  Magnific training   
XML and SQL Server Better friends than you thought Matt Hartman.
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
.NET Data Access and Manipulation
XML 1. Chapter 8 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SAMPLE XML SCHEMA (XSD) 2 Schema is a record definition, analogous to the.
1 Copyright © 2008, Oracle. All rights reserved. Repository Basics.
DAT 400 Inside Data Access with SQLXML: Architecture Guide Alexander Vaschillo Lead Program Manager WebData XML Group Microsoft Corporation.
DAT 390 Advanced ADO.NET Programming Techniques Jackie Goldstein Renaissance Computer Systems
 ADO.NET is an object-oriented set of libraries that allows you to interact with data sources  Commonly, the data source is a database, but it could.
Top 10 Entity Framework Features Every Developer Should Know
XML: Extensible Markup Language
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Tech·Ed North America /31/2018 4:35 PM
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
12/9/2018 6:15 AM © 2004 Microsoft Corporation. All rights reserved.
SQL Fundamentals in Three Hours
Chapter 10 ADO.
9/8/ :03 PM © 2006 Microsoft Corporation. All rights reserved.
Presentation transcript:

SQLXML XML Technology For SQL Server Brian Moore Developer and Platform Strategy Group Microsoft Corporation

Agenda SQLXML Overview SQLXML Overview SQLXML Technologies SQLXML Technologies Bulkload Data with SQLXML Bulkload Data with SQLXML Web Services with SQLXML Web Services with SQLXML

Converging Data Models SQLServer RowSet SQL XMLFilesXPathXML XMLView

SQLXML Overview Provides a rich XML view of relational data Provides a rich XML view of relational data  Benefits of XML – extensible, platform independent format of your data Semi-structured, hierarchical view of flat relational data Semi-structured, hierarchical view of flat relational data Two-way access – query and update Two-way access – query and update Multiple access mechanisms Multiple access mechanisms  HTTP, ADO, ADO.NET, SOAP

SQLXML Technologies T-SQL Language Extensions T-SQL Language Extensions  FOR XML  SQL language extension to retrieve XML instead of rowsets  OpenXML  Rowset provider for in-memory XML documents XML Views and XPath XML Views and XPath  Work with your relational database as if it was XML file (through annotated schema) Updategrams/Diffgrams Updategrams/Diffgrams  Update database through XML View Bulkload Bulkload  Shred large XML files into existing tables

Configuring SQLXML

Agenda SQLXML Overview SQLXML Overview SQLXML Technologies SQLXML Technologies Bulkload Data with SQLXML Bulkload Data with SQLXML Web Services with SQLXML Web Services with SQLXML

SQLXML Technologies FOR XML Language Extension FOR XML Language Extension HTTP Access via URL HTTP Access via URL  SQL Query  Templates  XPath Query ADO / OLEDB ADO / OLEDB SQLXML Managed Classes SQLXML Managed Classes Updategram/Diffgram/Bulkload Updategram/Diffgram/Bulkload SOAP SOAP

FOR XML Query T-SQL Language Extension T-SQL Language Extension SELECT… FROM… WHERE… ORDER BY… FOR XML (RAW | AUTO [, ELEMENTS] | NESTED [, ELEMENTS] | EXPLICIT) [, XMLData] [, BINARY base64]) SELECT… FROM… WHERE… ORDER BY… FOR XML (RAW | AUTO [, ELEMENTS] | NESTED [, ELEMENTS] | EXPLICIT) [, XMLData] [, BINARY base64])

Using FOR XML Using FOR XML syntax from SQL Managed Classes Using FOR XML syntax from SQL Managed Classes SqlConnection Conn = new SqlConnection(ConnStr); SqlCommand cmd = new SqlCommand("SELECT * FROM Authors FOR XML AUTO", Conn); Conn.Open(); XmlReader r = cmd.ExecuteXmlReader(); SqlConnection Conn = new SqlConnection(ConnStr); SqlCommand cmd = new SqlCommand("SELECT * FROM Authors FOR XML AUTO", Conn); Conn.Open(); XmlReader r = cmd.ExecuteXmlReader();

HTTP Access Via URL URL Query URL Query Template Template XML View XML View * FROM Customers FOR XML AUTO &root=CustomerList * FROM Customers FOR XML AUTO &root=CustomerList

XML Templates <root xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:xsl="[path to XSLT file]" > WA SELECT CompanyName, ContactName, Phone FROM Customers AS Customer WHERE Region FOR XML AUTO <root xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:xsl="[path to XSLT file]" > WA SELECT CompanyName, ContactName, Phone FROM Customers AS Customer WHERE Region FOR XML AUTO

XML Views Map between relational data and XML Map between relational data and XML Declarative Declarative Noninvasive Noninvasive  No changes to legacy data sources  No control over DB Server required XML View is an XML Schema XML View is an XML Schema  XDR for SQL Server 2000 and SQLXML 1.0  XSD for SQLXML 2.0 and beyond

XML Views Default Mapping Example CustID A NULL B XML View Relational Data Customers Table <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema"> <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema">

XML Views Explicit Mapping Example strCustID A NULL B Relational Data tblCustomers Table XML View <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema"> <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema">

Join Example <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema"> <msdata:relationship parent="Customers" parent-key="CustomerID" child="Orders" child-key="CustomerID" /> <xsd:schema xmlns:xsd=" xmlns:msdata="urn:schemas-microsoft-com:mapping-schema"> <msdata:relationship parent="Customers" parent-key="CustomerID" child="Orders" child-key="CustomerID" />

XPath Use XPath to query SQL Database as if it was an XML file Use XPath to query SQL Database as if it was an XML file Each query translates into a SQL statement Each query translates into a SQL statement XPath XPath

SQLXML Technologies

Agenda SQLXML Overview SQLXML Overview SQLXML Technologies SQLXML Technologies Bulkload Data with SQLXML Bulkload Data with SQLXML Web Services with SQLXML Web Services with SQLXML

Application Scenario Business to Business Data Interchange XSDSchema Annotations + =MappingSchemaSQLServer XML Results + XPATH/Customers Query SQLServer Send Bulkload

XML Bulkload Bulkload XML documents into a SQL Server database via the XML View Bulkload XML documents into a SQL Server database via the XML View Just like traditional bulkload, except supports hierarchical relationships and semi-structured data Just like traditional bulkload, except supports hierarchical relationships and semi-structured data Scriptable COM object Scriptable COM object  Requires P/Invoke in.NET Performance is about 75% of traditional bulkload Performance is about 75% of traditional bulkload Can use or ignore database constraints Can use or ignore database constraints

Bulkload Data with SQLXML

Agenda SQLXML Overview SQLXML Overview SQLXML Technologies SQLXML Technologies Bulkload Data with SQLXML Bulkload Data with SQLXML Web Services with SQLXML Web Services with SQLXML

Web Services with SQLXML WSDL file describing each SPROC or template exposed WSDL file describing each SPROC or template exposed Tool to choose which SPROC or template to expose Tool to choose which SPROC or template to expose SQLServer IIS/ISAPI SOAPMessage Message SP Template WSDL Client

Web Services with SQLXML

Call To Action Take the next step with SQL Server Web Services for your application Take the next step with SQL Server Web Services for your application  Meet with the Microsoft technical team to discuss an Architectural Design Session or a Proof of Concept at the Microsoft Technology Center Download SQLXML 3.0 SP2 Download SQLXML 3.0 SP2  For more information, please For more information, please  Slides available at Slides available at  

SQL Server Summit Brought To You By:

© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

Additional Slides

Additional Slides SQLXML Overview

SQLXML Architecture Query Processor Annotated XSD Mapping Schemas XPath XQuery(Future) Query XML SQL Server SQL Server Rowsets FOR XML SQLQueries Queries SQLQueries Queries XMLBulkload BCP/SQLXML Updategrams/Diffgrams SQL update/ insert/ delete XML

Additional Slides FOR XML

For XML Raw Mode One element per row in the result set One element per row in the result set  No nested elements  Columns/values in result set are attributes/values on the  Columns/values in result set are attributes/values on the Similar to row set but in XML format Similar to row set but in XML format

For XML Auto Mode Supports nested XML output Supports nested XML output  Nesting determined by ordering of columns in SELECT clause  Table/View name in database used for the element name  Column names used for attributes  Change names using table and column aliases......

For XML Nested Mode Similar to Auto Mode Similar to Auto Mode  Expanding query result into XML format moved from SQL Server to middle tier (client-side)  Not all metadata in the database is available on the middle tier  Base table name in database used for the element name  Column names used for attributes  Change column names only......

For XML Explicit Mode Provides complete control over format of XML result Provides complete control over format of XML result  Columns can be individually mapped to attributes or sub elements  Supports arbitrary nesting  Collapses/hoists hierarchy  Constructs ID/IDREF relationships Explicit mode requires the SELECT query to be written in a certain way to produce the "universal table format" Explicit mode requires the SELECT query to be written in a certain way to produce the "universal table format"

For XML Explicit Mode Example SELECT 1 as TAG, NULL as PARENT, CustomerID AS [Customer!1!cid!id], CompanyName AS [Customer!1!name!element], NULL AS [Order!2!oid!id] FROM Customers WHERE CustomerID = 'ALFKI' OR CustomerID='BOLID' UNION ALL SELECT 2, 1, Customers.CustomerID, NULL, 'O-'+CAST(Orders.OrderID AS varchar(32)) FROM Customers INNER JOIN Orders ON Customers.CustomerID=Orders.CustomerID WHERE Customers.CustomerID = 'ALFKI' OR Customers.CustomerID='BOLID' ORDER BY [Customer!1!cid!id] FOR XML EXPLICIT SELECT 1 as TAG, NULL as PARENT, CustomerID AS [Customer!1!cid!id], CompanyName AS [Customer!1!name!element], NULL AS [Order!2!oid!id] FROM Customers WHERE CustomerID = 'ALFKI' OR CustomerID='BOLID' UNION ALL SELECT 2, 1, Customers.CustomerID, NULL, 'O-'+CAST(Orders.OrderID AS varchar(32)) FROM Customers INNER JOIN Orders ON Customers.CustomerID=Orders.CustomerID WHERE Customers.CustomerID = 'ALFKI' OR Customers.CustomerID='BOLID' ORDER BY [Customer!1!cid!id] FOR XML EXPLICIT

Additional Slides Bulkload Data with SQLXML

Application Scenario Disconnected, Remote Clients SQLServer XML View for two-tier Data Source XML View for remote HTTP Data Source DisconnectedClientapplication RemoteSQLServer Logical Business Object (XML document Instance) XPath or Template queries via ADO UpdateGrams via ADO UpdateGrams via HTTP XPath or Template queries via HTTP

UpdateGrams Update relational data through XML View Update relational data through XML View  Retrieve all customers as XML File  Change a few customers in XML File  Update relational data Translated into one or more INSERT, UPDATE, and DELETE statements behind the scenes Translated into one or more INSERT, UPDATE, and DELETE statements behind the scenes Relational operations are transparent to the user Relational operations are transparent to the user Optimistic concurrency control Optimistic concurrency control

DiffGrams Like UpdateGrams, but uses a different XML grammer to express updates Like UpdateGrams, but uses a different XML grammer to express updates Can be generated from an ADO.NET DataSet Can be generated from an ADO.NET DataSet Translated into one or more INSERT, UPDATE, and DELETE statements behind the scenes Translated into one or more INSERT, UPDATE, and DELETE statements behind the scenes Relational operations are transparent to the user Relational operations are transparent to the user Optimistic concurrency control Optimistic concurrency control

Updategrams <updg:sync mapping-schema="schema.xsd" xmlns:updg="urn:schemas-microsoft-com:xml-updategram"> <updg:sync mapping-schema="schema.xsd" xmlns:updg="urn:schemas-microsoft-com:xml-updategram">

Diffgrams <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:xsd=" <Customers diffgr:id="Customers1" msdata:rowOrder="0" diffgr:hasChanges="modified"> ALFKI New Company ALFKI Alfreds Futterkiste <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:xsd=" <Customers diffgr:id="Customers1" msdata:rowOrder="0" diffgr:hasChanges="modified"> ALFKI New Company ALFKI Alfreds Futterkiste

Additional Slides SQLXML Managed Classes

SqlXmlAdapter Dataset Fill Update SQLXML Managed Classes XmlReader Database SqlCommand FOR XML XMLVIEW SqlXmlCommand XML XPath XQueryTemplate XML

SQLXML Managed Classes SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.XPath; cmd.CommandText = cmd.SchemaPath = "nwind.xml"; cmd.RootTag = "ROOT"; cmd.XslPath = "Customers.xsl"; XmlReader r = cmd.ExecuteXmlReader(); //Or... DataSet ds = new DataSet(); SqlXmlAdapter ad = new SqlXmlAdapter(cmd); ad.Fill(ds); //... ad.Update(ds); //DataSet generates diffgram. SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.XPath; cmd.CommandText = cmd.SchemaPath = "nwind.xml"; cmd.RootTag = "ROOT"; cmd.XslPath = "Customers.xsl"; XmlReader r = cmd.ExecuteXmlReader(); //Or... DataSet ds = new DataSet(); SqlXmlAdapter ad = new SqlXmlAdapter(cmd); ad.Fill(ds); //... ad.Update(ds); //DataSet generates diffgram.

Using Templates from.NET SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.Template; cmd.CommandStream = new FileStream("tmpl.xml", FileMode.Open, FileAccess.Read); cmd.ExecuteToStream(Response); SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.Template; cmd.CommandStream = new FileStream("tmpl.xml", FileMode.Open, FileAccess.Read); cmd.ExecuteToStream(Response);

XPath Using the SQLXML Managed Classes SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.XPath; cmd.CommandText = cmd.SchemaPath = "nwind.xml"; cmd.RootTag = "ROOT"; cmd.XslPath = "Customers.xsl"; XmlReader r = cmd.ExecuteXmlReader(); SqlXmlCommand cmd = new SqlXmlCommand(ConnStr); cmd.CommandType = SqlXmlCommandType.XPath; cmd.CommandText = cmd.SchemaPath = "nwind.xml"; cmd.RootTag = "ROOT"; cmd.XslPath = "Customers.xsl"; XmlReader r = cmd.ExecuteXmlReader();