© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 1 IT 390 Business Database Administration Unit 9:

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
The Web Warrior Guide to Web Design Technologies
Database Processing Applications and Business Intelligence Chapter Seven DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
1 Chapter 12 Working With Access 2000 on the Internet.
Fundamentals, Design, and Implementation, 9/e Chapter 12 ODBC, OLE DB, ADO, and ASP.
Prentice Hall © COS 346 Day Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall COS 346 Day 23.
Fundamentals, Design, and Implementation, 9/e COS 346 DAY 22.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 12-1 COS 346 Day 22.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
1 Chapter 1 Tour of Access. 1 Chapter Objectives Start and exit Microsoft Access Open and run an Access application Identify the major elements of the.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
ODBC Open DataBase Connectivity a standard database access method developed by Microsoft to access data from any application regardless of which database.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
A First Program Using C#
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 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Integrating XML with Microsoft SQL Server ©NIITeXtensible Markup Language/Lesson 9/Slide 1 of 31 Objectives In this lesson, you will learn to: * Generate.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 12-1 David M. Kroenke’s Chapter Twelve: ODBC, OLE DB, ADO, and ASP Part.
1 ODBC, OLE DB, ADO, and ASP. 2 Introduction  Because database applications today reside in a complicated environment, various standards have been developed.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
Tutorial 10 Adding Spry Elements and Database Functionality Dreamweaver CS3 Tutorial 101.
MAHI Research Database Data Validation System Software Prototype Demonstration September 18, 2001
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Using Visual Basic 6.0 to Create Web-Based Database Applications
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
MCTS Guide to Microsoft Windows Server 2008 Applications Infrastructure Configuration (Exam # ) Chapter Four Windows Server 2008 Remote Desktop Services,
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
Objectives Overview Define the term, database, and explain how a database interacts with data and information Describe the qualities of valuable information.
Universal Data Access and OLE DB. Customer Requirements for Data Access Technologies High-Performance access to data Reliability Vendor Commitment Broad.
Advanced Topics Chapter Seven DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
+ Connecting to the Web Chapter 7. + Chapter Objectives Understand and be able to set up Web database processing Learn the basic concepts of Extensible.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
Chapter 29. Copyright 2003, Paradigm Publishing Inc. CHAPTER 29 BACKNEXTEND 29-2 LINKS TO OBJECTIVES Attach an XML Schema Attach an XML Schema Load XML.
Using databases ActiveX Data Objects (ADO) Connecting to a database Reading data from a database Inserting, updating and deleting records Using databases.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
ASP.NET Programming with C# and SQL Server First Edition
JDBC Database Management Database connectivity
VISUAL BASIC INTRODUCTION TO DATA CONNECTIVITY.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Tutorial 7 – Integrating Access With the Web and With Other Programs
Presentation transcript:

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 1 IT 390 Business Database Administration Unit 9: Database Access Standards

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 2 Objectives Identify and classify ODBC, OLE DB, and ASP standards.  Introduce database access standards.  Explain ODBC, OLE DB and ASP standards. Define and apply basic XML and ADO.NET Explain XML and ADO.NET

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 3 You need interfaces to enable applications interact and exchange data with databases. ODBC is a Microsoft specification for creating a database application programming interface (API). The ODBC API is implemented in the form of drivers. ODBC Introduction

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 4 More about ODBC The ODBC works as an interface between an RDBMS and Application Program. This setup works in a three-tier architecture. SQL Server 2000 connects to development modules using specific API drivers.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 5 ODBC Architecture The components of ODBC architecture enable the ODBC API to communicate with a database. These components interact with each other to make the database accessible to the user.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 6 ODBC Visual Overview API SQL Server 2000 ODBC API

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 7 Functions of ODBC Enables applications to communicate with different databases Facilitates SQL grammar conversion Enables a single application to use different drivers Enables applications to interact with different types of databases Allows the use of enhanced DBMS features Enables applications to achieve a three-layered architecture

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 8 There are four components of the ODBC architecture that interact with each other to to make the required output available to the user. Application: Applications are the programs that call the ODBC API to communicate with the DBMS. Components of ODBC

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 9 Driver manager: It is the component that enables communication between an application and a driver by monitoring the transactions between them. A driver manager also performs basic error- handling tasks after a connection is established between the application and the driver. Components of ODBC

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 10 Drivers: Drivers are software components that provide functions in the ODBC API. Data source: A data source stores all the information that is necessary to connect to a database or a DBMS that is stored on the same computer as the client computer or on another computer on the network. Components of ODBC (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 11 ODBC is NOT Microsoft exclusively

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 12 You use the ODBC Data Source Administrator dialog box to create a DSN. The ODBC Data Source Administrator function is available in Control Panel in the Windows 98 operating system. In Windows 2000, the ODBC Data Source Administrator function is available under Administrative Tools. To set up an ODBC Data Source:  Double-click the Data Sources icon in the Control Panel. Setting Up an ODBC Data Source

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 13 Then, on the ODBC Data Source Administrator screen, click the System DSN tab. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 14 In the System DSN tabbed page, click the Add button. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 15 Clicking the Add button displays the Create New Data Source dialog box. In this dialog box, select the SQL Server option, and click the Finish button. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 16 The Create a New Data Source to SQL Server wizard appears. In the first screen of the Create New Data Source Wizard, specify the name for a data source, a description for the data source, and the name of the SQL Server that you want the DSN to connect. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 17 On the next screen, click the With SQL Server authentication using a login ID and password entered by the user option. Then, specify a login ID and password. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 18 After specifying the login ID and password for SQL authentication, select the Change the default database to option, and select the name of the database from the drop-down list. Accept the default selections for other options, and then click the Next button. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 19 On the next screen of the wizard, accept all the default selections, and then click the Finish button. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 20 You can see the data source name included in the list of other data sources on the System DSN tabbed page. Setting Up an ODBC Data Source (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 21 To connect to the database, you need a front-end application. In addition, you need to call the following functions in the code of the front-end application. 1. Call the SQLAllocEnv or SQLAllocHandle function to get an environment handle. 2. Call the SQLAllocConnect function. 3. Call the SQLConnect function. 4. Call the SQLExecDirect function to execute the SQL statements. 5. Call the SQLFreestmt function to close the connection. Using an ODBC Data Source

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 22 State whether True or False The functions of ODBC are: 1) Enables applications to communicate with only SQL Server ) Enables a single application to use different drivers.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 23 Solution (True or False) 1) False 2) True

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 24 Class Activity Choose the correct ODBC components from the following list:  Application  File system  Driver manager  Driver  Operating system  Data source

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 25 Solution Application Driver manager Driver Data source

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 26 OLE DB consists of three components:  Data providers  Data consumers  Service components OLE DB and its Components

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 27

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 28

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 29 An ADO object model uses object-oriented programming techniques to communicate with the underlying data source. ADO creates a layer between the applications and the OLE DB provider. The ADO object model consists of nine objects and four collections.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 30 The nine objects are: Connection Error Command Recordset Record Parameter Field Property Stream The ADO Object Model (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 31 The four collections are: Fields Properties Parameters Errors The ADO Object Model (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 32 The generic steps to access databases using ADO are: 1. Set up reference to an ADO Connection object. 2. Define the connection string to be used when opening the connection object. The connection string can be defined in two ways, with a DSN or without a DSN. 3. Open the connection object by using the Open method of the connection object. 4. Use the state property of the connection object to check whether or not a connection is established successfully. Accessing Databases by Using ADO

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 33 5.Execute SQL statements after the connection is established. 6.Create a recordset object and execute it by using the Open method of the recordset object. 7.Close the recordset object. In addition, close the connection object by calling the Close method of the connection object. Accessing Databases Using ADO (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 34 Active Data Objects (ADO) Active Data Objects (ADO) characteristics:  A simple object model for OLE DB data consumers.  It can be used from VBScript, JScript, Visual Basic, Java, C#, C++.  It is a single Microsoft data access standard.  Data access objects are the same for all types of OLE DB data.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 35 Invoking ADO from Active Server Pages In Microsoft’s Active Server Pages (ASP) are Web pages where:  Statements are enclosed within the characters.  ASP statements are processed on the Web server.  Other (HTML) statements are processed by the client Web browser.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 36 The ADO Object Model

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 37 Connection Object A connection object establishes a connection to a data provider and data source.  Connections have an isolation mode. Once a connection is created, it can be used to create RecordSet and Command objects.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 38 RecordSet Objects RecordSet objects represent cursors:  They have both CursorType and LockType properties.  RecordSets can be created with SQL statements.  The Fields collection of a RecordSet can be processed to individually manipulate fields.  The Errors collection contains one or more error messages that result from an ADO operation.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 39 Command Object The command object is used to execute stored parameterized queries or stored procedures:  Input data can be sent to the correct ASP using the HTML FORM tag.  Table updates are made using the RecordSet Update method.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 40 ADO Constants: Isolation Levels

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 41 ADO Constants: Cursor Levels

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 42 ADO Constants: Lock Types

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 43 Connection Object: ASP Code <% Dim objConn Set objConn = Server.CreateObject (“ADODB.connection”) objConn.IsolationLevel = adXactReadCommitted ‘ use ADOVBS objConn.Open “ViewRidgeSS”, %> <% objConn.Open “DSN=ViewRidgeOracle2;UID=DK1;PWD=Ses ame” %>

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 44 RecordSet Object: ASP Code <% Dim objRecordSet, varSql varSQL = “SELECT * FROM ARTIST” Set objRecordSet = Server.CreateObject(“ADODB.Recordset ”) objRecordSet.CursorTye = adOpenStatic objRecordSet.LockType = adLockReadOnly objRecordSet.Open varSQL, objConn %>

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 45 Fields Collection: ASP Code <% Dim varI, varNumCols, objField varNumCols = objRecordSet.Fields.Count For varI = 0 to varNumCols - 1 Set objField = objRecordSet.Fields(varI) ‘ objField.Name now has the name of the field ‘ objField.Value now has the value of the field ‘ can do something with them here Next >%

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 46 Errors Collection: ASP Code <% Dim varI, varErrorCount, objError On Error Resume Next varErrorCount = objConn.Errors.Count If varErrorCount > 0 Then For varI = 0 to varErrorCount - 1 Set objError = objConn.Errors(varI) ‘ objError.Description contains ‘ a description of the error Next End If >%

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 47 Command Object: ASP Code <% Dim objCommand, objParam, objRs ‘Create the Command object, connect it to objConn and set its format Set objCommand = Server.CreateObject(“ADODB.command”) Set objCommand.ActiveConnection = objConn objCommand.CommandText=“{call FindArtist (?)}” ‘Set up the parameter with the necessary value Set objParam = objCommand.CreateParameter (“Nationality”, adChar, adParamInput, 25) objCommand.Parameters.Append objParam objParam.Value = “Spanish” ‘Fire the Stored Proc Set objRs = objCommand.Execute >%

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 48 ADO Example: Reading a Table Artist.asp

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 49 ADO Example: Reading a Table The Artist.asp Results

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 50 Class Activity Identify the objects in the ADO Model:  Connection  Error  Recordset  File  Attribute  Stream

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 51 Solution Connection Error Recordset Stream

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 52 XML provides a way to define meaningful data structures and eases the process of data exchange. The advantages of using XML are:  Provides extensible tags to define application- specific data structures  Enables the creation of platform-independent application  Requires only updated document to be uploaded on the Internet instead of the complete document  Displays the same information in different formats on the Web Accessing Databases by Using XML

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 53 More about XML Provides extensible tags for defining application-specific data structures. Enables the creation of platform-independent applications. Helps reduce the Internet traffic.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 54

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 55 XML can be used to present any kind of information in a simple, structured format. The following are the parts of an XML document:  An XML document begins with a declaration tag.  The second component in an XML document is called an element. An element is referred to as a root element, when it describes the details about all other elements.  Below the root element, there is a hierarchy of elements. XML Documents

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 56  All the elements in an XML document contain some data. The data is called content. When you create an XML document, you need to follow certain rules. These rules are:  Every start tag should have a closing tag called the end tag.  Tags should not overlap because XML documents follow a hierarchy.  There can be only one root element. XML Documents (cont.)

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 57 The architecture of an application has three layers.  The business layer  The data layer  The user interface These layers communicate with each other and exchange data to perform the functions required in an application. In this entire process of data exchange, XML is used extensively at each stage. XML for Data Exchange

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 58 SQL Server 2000 and Relational Data in XML SQL Server 2000 provides the OPENXML function to insert and update records in the database from an XML document. The OPENXML function reads the data from an XML document and inserts it into the database.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 59 SQL server 2000 is an XML-enabled RDBMS that retrieves data from an SQL database and presents it as XML data. To retrieve data, you need to use the FOR XML clause in the SELECT statement. To get the XML output for a SQL query, an additional clause is added at the end of the SQL statement: [FOR XML {RAW|AUTO|EXPLICIT} [, XMLDATA] [, ELEMENTS] [, BINARY base64]] The FOR XML clause has three distinct options: RAW, AUTO, and EXPLICIT. Integrating XML with SQL Server 2000

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 60 SQL Server 2000 provides the OPENXML function to insert and update records in a database from an XML document. To insert and update records, the OPENXML function uses two system stored procedures:  sp_xml_preparedocument  sp_xml_removedocument Inserting and Updating Relational Data from XML Data

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 61 Class Activity Identify the error in the following XML code displaying the employee name: Joe

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 62 Solution The correct code is: Joe /*the closing tag was missing*/

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 63 Rules for Creating an XML Document Start tag has a closing tag called the end tag. Tags should not overlap because an XML document follows a hierarchy. There can be only one root element. XML is a case-sensitive language.

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 64 Class Activity Identify the various XML formatting options: 1) RAW 2) AUTO 3) TEXTSPACE 4) EXPLICIT 5) NAME

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 65 Solution RAW AUTO EXPLICIT

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 66 ODBC is a specification for creating a database API. There are four main components of ODBC:  Application  Driver Manager  Driver  Data Source You use the ODBC Data Source Administrator dialog box to create a DSN. Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 67 OLE DB and ADO provide a common method to access data from different data sources. OLE DB has three components:  Data provider  Data consumers  Service components Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 68 The ADO object model consists of the following nine objects:  Connection  Error  Command  Recordset  Record  Parameter  Field  Property  Stream Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 69 The steps to access database using ADO are: 1. Set up reference to an ADO Connection object. 2. Define the connection string to be used. 3. Open the connection object. 4. Use the state property to check the establishment of the connection. 5. Execute SQL statements. 6. Create a recordset object. 7. Close the recordset object and the connection object. Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 70 XML is a standard that can present structured data in the text format on the Web. Parts of an XML document:  Declaration statement  Tags  Elements Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 71 You use the FOR XML clause in the SELECT statement to integrate XML with SQL Server. The FOR XML clause has three distinct options:  RAW  AUTO  EXPLICIT SQL Server 2000 provides an OPENXML function to insert and update records in a database from an XML document. Summary

© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 9 Slide 72  Did you understand the key points from the Lesson?  Do you have any questions?? Summary