Dev399 SQLXML: XML Views and Relational Data Irwin Dolobowsky Program Manager Webdata Group Microsoft Corporation.

Slides:



Advertisements
Similar presentations
XML: Extensible Markup Language
Advertisements

Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Java Script Session1 INTRODUCTION.
DEV351 ADO.NET Performance Pablo Castro Program Manager – ADO.NET Team Microsoft Corporation.
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
Inside Data Access with SQLXML: Architecture Guide Rolandas Gricius MCT, MCSE, MCSD Adapted From.
1 COS 425: Database and Information Management Systems XML and information exchange.
Microsoft Office Open XML Formats Brian Jones Lead Program Manager Microsoft Corporation.
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
Exploring Microsoft® Office Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Robert Grauer and Maryann Barber Using.
SQL Server 2000 and XML Erik Veerman Consultant Intellinet Business Intelligence.
SQL Server ® 2008 ® Native Client. Agenda  Introduction to SQL Server Native Client  Building High-Performance Data Access Solutions  Going Beyond.
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
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.
Module 17 Storing XML Data in SQL Server® 2008 R2.
2.2 SQL Server 2005 的 XML 支援功能. Overview XML Enhancements in SQL Server 2005 The xml Data Type Using XQuery.
OFC302 Building Smart Document Solutions in Word & Excel Martin Sawicki Lead Program Manager.
OFC 322 Building Office Research Web Services: Exposing Corporate Data Through Office Brian Jones Program Manager Authoring Services Martin Sawicki Lead.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
OFC304 Excel 2003 Overview: XML Support Joseph Chirilov Program Manager.
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.
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
Sofia, Bulgaria | 9-10 October Using XQuery to Query and Manipulate XML Data Stephen Forte CTO, Corzen Inc Microsoft Regional Director NY/NJ (USA) Stephen.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
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.
DAT305 Boost Your Data-Driven Application Development Using SQL Server Centric.NET Code Generator Pascal Belaud Microsoft France.
OFC 303 Advanced Word XML: Customer-Defined Schemas Brian Jones Program Manager Authoring Services.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
OFC 308 Advanced Word XML: The WordML Schema and Bringing Everything Together Brian Jones Program Manager Authoring Services.
DAT 379 XML Today And Tomorrow Mark Fussell Lead Program Manager Microsoft Corporation.
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
Searching Business Data with MOSS 2007 Enterprise Search Presenter: Corey Roth Enterprise Consultant Stonebridge Blog:
Web 310 XML Schema : What You Need to Know and Why Yasser Shohoud Program Manager XML Messaging Microsoft Corporation.
DEV337 Modeling Distributed Enterprise Applications Using UML in Visual Studio.NET David Keogh Program Manager Visual Studio Enterprise Tools.
Module 18 Querying XML Data in SQL Server® 2008 R2.
Advanced ETL: Embedding Integration Services Ashvini Sharma Development Lead DAT411 Microsoft Corporation Sergei Ivanov Technical Lead DAT411 Microsoft.
DAT 360: DTS in SQL Server 2000 Best Practices Euan Garden Group Manager, SQL Server Microsoft Corporation.
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.
OFC291 Microsoft® Office Word XML (part 1 of 3): Introduction Martin Sawicki Lead Program Manager.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
DAT 332 SQL Server 2000 Data Transformation Services (DTS) Best Practices Euan Garden Product Unit Manager SQL Server Development Microsoft Corporation.
XML and Database.
Master Data Management & Microsoft Master Data Services Presented By: Jeff Prom Data Architect MCTS - Business Intelligence (2008), Admin (2008), Developer.
EBIZ327 InfoPath and BizTalk Server 2004 Scott Woodgate Jupiter Product Planner.
MSG331 Exchange Server 2000/2003 Software Development Kit Susan Hill Lead Programmer Writer Microsoft Corporation.
DAT300 SQL Server Notification Services: Application Development Ken Henderson Technical Lead, SQL Server Support Microsoft Corporation
MBL 305 ASP.NET Mobile Controls: Best Practices Gökşin Bakir CSA Yage Ltd. Microsoft Regional Director.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Chapter 14 1 Chapter 14 Storing and Retrieving XML in SQL Server 2000 November 6, 2001 Sook-Kyo Kwon.
EBIZ302 Jupiter Business Process Automation and Web Services David Fong Program Manager.
SQLXML XML Technology For SQL Server Brian Moore Developer and Platform Strategy Group Microsoft Corporation.
Microsoft Visual Studio 2005 Tools for the Office System: Building Office Solutions Using Visual Studio 2005 Tools for Office Andrew Coates Developer Evangelist.
DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant.
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.
MSG 334 Creating Exchange Administrative Scripting for the Non-Programmer Susan Hill Lead Programmer Writer Microsoft Corporation.
OFC311 Developing Microsoft Office InfoPath 2003 Solutions: Technical Drilldown Part 1 Tudor Toma Group Program Manager Office Microsoft Corporation.
The 2007 Microsoft Office System Servers Enterprise Content Management, Workflow and Forms Martin Parry Developer and Platform Group, Microsoft Ltd
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
Building Enterprise Applications Using Visual Studio®
XML: Extensible Markup Language
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Avalon – Using Data In Your Applications
Data Virtualization Tutorial: JSON_TABLE Queries
Searching Business Data with MOSS 2007 Enterprise Search
Searching Business Data with MOSS 2007 Enterprise Search
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Presentation transcript:

Dev399 SQLXML: XML Views and Relational Data Irwin Dolobowsky Program Manager Webdata Group Microsoft Corporation

Overview of talk Goals of presentation: Learn about the XML View Examine leveraging Xml View in application scenarios Agenda: A survey of the SqlXml features that provide the XML View Discuss strengths and weaknesses of each feature See the features in action

SqlXml – A Quick History The project started in 1998 to solve XML to relational mapping problem Version 1.0 of product shipped as part of SQL Server 2000 Both Client and Server functionality New “Web Releases” of client functionality are available via the MSDN web site: Three fully supported releases since the initial Sql Server 2000 release.

Different kinds of data Structured Highly regular, homogeneous structure Rowsets, Comma delimited files Semi-Structured Heterogeneous structure Sparse Occurrences of data HTML and XML documents Unstructured Documents/Content

The Two Worlds SQLServer RowSet SQL Structured world Language Data storage Data output Semi- Structured world XMLFiles XPath XML/HTML XMLView SQLXML – Bringing worlds together

What is the “XML View” ? The XML view is a virtual collection of XML documents created over a SQL Server database The XML view can completely encapsulate and hide the underlying relational structures The resulting XML documents can easily represent hierarchical, semi-structured content

The XML View - Architecture SQLServer Relation tables Relation views Relation Storedprocs For XML Queries AnnotatedXSDMappingSchemas XPath Queries Updategrams XMLBulkload XSLT

Annotated Mapping Schemas Defines an XML View of a database Uses XSD schemas with special annotations Annotations specify the mapping between xml and relational data XPath is used to query the XML View Changes to an XML View are persisted to database via Updategrams

Tables and Columns Default mapping: Elements map to tables of the same name Attributes map to columns in the table Explicit mapping: sql:relation maps to a table sql:field maps to a column

Default Mapping CustID A NULL B XML View Relational Data: Customers Table

Explicit Mapping <xsd:schema xmlns:xsd=" xmlns:sql="urn:schemas-microsoft-com:mapping-schema“> pkCustID A NULL B Relational Data: tblCustomers Table

Join Relationships Require an explicit annotation to describe the join: < sql:relationship parent=“Table1" parent-key=“pk" child=“Table2” child-key=“fk" /> Expresses the SQL join SELECT * FROM Table1 JOIN Table2 ON Table1.pk= Table2.fk

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

Some other annotations Ignore schema components: Query on field which is not returned in results: Introduce XML elements that do not map to the database: …

Can even map Open Content Map SQL data as XML text: Notes

XPath Navigation language (used by XSLT to select nodes in an XML document) Compact syntax resembles file paths or URLs: Each XPath translates into a SQL query using FOR XML EXPLICIT to construct the XML For complete details on XPath, see the W3C specification at:

XPath and XML Views Irwin Dolobowsky Program Manager Webdata demo demo

XPath and the XML View in real life The shape of the generated XML instance document can be very different then the underlying relation storage Multiple databases (with different schemas) can provide a common XML view Much easier to develop and maintain than For XML Explicit queries

For XML – Explicit Mode 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”

For XML – Explicit Mode 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

Updategrams & XML Views Modify the database through the XML View Declare before and after images of the XML (what it is now, and what you want it to be) Optimistic concurrency control ensures that the transaction takes place only if the before image matches the current database state Each updategram is translated into one or more INSERT, UPDATE, and DELETE statements, carried out as a single transaction

Updategrams And XMLViews

Updategrams in real life Enables persisting of changes to XML view by disconnected clients Can easily represent hierarchical changes to data Existing programming model is limited, client must generate updategrams manually

XML Bulkload & XML Views Bulkload XML documents into a SQL Server database via the XML View Just like traditional bulkload, except supports hierarchical relationships and semi-structured data Scriptable COM object Performance is about 75% of traditional bulkload

XML Bulkload & XML Views Sample Bulkload vbs script: set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad") objBL.ConnectionString = "provider=SQLOLEDB.1;data source=(local);database=tempdb;uid=sa;pwd=" objBL.ErrorLogFile = "error.xml" objBL.XMLFragment = True objBL.CheckConstraints = False objBL.Execute "schema.xsd", "data.xml" Set objBL = Nothing

XML Bulkload in real life Very fast, efficient way to shred XML and insert in to a SQL Server database XML Views allows the publisher and consumer of the data to have different database schemas Currently, does not support “max errors” so bulkload processing is stopped by first problem

Data Access Methods HTTP Access via URL SQL Query XPath Query Templates ADO / OLEDB.NET access through SQLXML Managed Classes SOAP

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

XML View Application Scenario – A data driven web site Problem: Need to publish data driven web site with minimal coding Control of SQL Server database api (table, stored procs, views) is limited Solution: Define an XML View and apply XSLT to the instance documents to generate HTML User communicates with web site through template parameters

XML View Application Scenario – Disconnected Clients: Problem: Client application is required to consume data from different SQL Server databases Client may need disconnected, HTTP access to SQL Server Solution: Define common XML View Client queries with XPath, and submits changes via updategrams using SQL Server HTTP access

XML View Application Scenario – Data Interchange: Problem: Want to exchange large amounts of data with other applications Need to decouple the logical business from the database schema Solution: Run XPath queries against XML View to generate data Incrementally load into destination database using XML View (different mappings) and XML Bulkload

Using the Xml View to decouple business objects from database demo demo

A decoupled architecture Class Employee { int ID, int ID, string lastName, string lastName, string firstName, string firstName, …} Class EmployeeAddress { string street, string street, string city, string city, string state, string state, …. ….} <Employee> Jones Jones Jeff Jeff 122 Oak 122 Oak Tacoma Tacoma WA WA </Employee> SQLServer CLR Business Objects Relational Database XML SqlXml Xml Serialization

Demo is available online Complete Demo available at MSDN Extreme Xml column- April column – “Death, Taxes and Relational databases, Part 1” uses server side technologies OpenXml and For Xml. July column will use Annotated Mapping schemas and updategrams. Extreme Xml column contains SqlXml specific column approximately four times a year.

Other SqlXml resources Download latest SqlXml release at Learn about product via documentation and supporting material at SqlXml SqlXml books “The Guru's Guide to SQL Server(TM) Stored Procedures, XML, and HTML” - Pearson Education “Programming Microsoft SQL Server 2000 with XML”, Second Edition – Microsoft Press

SqlXml Community Resources Newsgroups microsoft.public.sqlserver.xml microsoft.public.dotnet.xml SqlXml Blog

Community Resources Most Valuable Professional (MVP) Newsgroups Converse online with Microsoft Newsgroups, including Worldwide User Groups Meet and learn with your peers

Ask The Experts Get Your Questions Answered After this talk ATE – Thursday July 3 rd 11:00-14:00

evaluations evaluations

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