Introduction to XML CS348 Information System Guest Lecture Hazem Elmeleegy.

Slides:



Advertisements
Similar presentations
Database programming in Java An introduction to Java Database Connectivity (JDBC)
Advertisements

JDBC. Java Database Connectivity (JDBC) Use the java.sql package to query and update the database. JDBC is an API that allows java to communicate with.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
19-Jun-15 SQL. SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell” is the only correct.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Java Database Connectivity (JDBC) java.sql package to query and update the database. JDBC is an API that allows java to communicate with a database server.
JDBC. In This Class We Will Cover: What SQL is What ODBC is What JDBC is JDBC basics Introduction to advanced JDBC topics.
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
XMLII XSchema XSchema XQuery XQuery. XML Schema XML Schema is a more sophisticated schema language which addresses the drawbacks of DTDs. Supports XML.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Introduction to JDBC (Java Database Connectivity).
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
XMLII XSchema XSchema XQuery XQuery Oracle XSU Oracle XSU.
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 8 Object Oriented Programming in Java Advanced Topics Java Database.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
XML Overview. Chapter 8 © 2011 Pearson Education 2 Extensible Markup Language (XML) A text-based markup language (like HTML) A text-based markup language.
 2004 Keith Vander Linden. All Rights Reserved. Calvin CollegeDepartment of Computer Science(1/25) Database Programming with JDBC Keith Vander Linden.
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro.
 XML is designed to describe data and to focus on what data is. HTML is designed to display data and to focus on how data looks.  XML is created to structure,
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
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.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
Object-Oriented Software How does it differ from procedural? How is it similar to procedural? Why has it become so popular? Does it replace or supplement.
JDBC Java and Databases, including Postgress. JDBC l Developed by Industry leaders l Three main goals: –JDBC should be an SQL-level API –JDBC should capitalize.
JDBC. JDBC stands for Java Data Base Connectivity. JDBC is different from ODBC in that – JDBC is written in Java (hence is platform independent, object.
JDBC  The JDBC (Java Database Connectivity) API helps a Java program to access a database in a standard way  JDBC is a specification that tells the.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
Copyright  Oracle Corporation, All rights reserved. 6 Accessing a Database Using the JDBC API.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
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.
Copyright © 2002 ProsoftTraining. All rights reserved. Building Database Client Applications Using JDBC 2.0.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
XML STORAGE AND XPATH QUERIES IN ORACLE Jiankai Wu & Joel Poualeu.
XML and Database.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Application Development Chapter 6 Sections –
CS 157B: Database Management Systems II February 11 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
16 Java Database Connectivity. 2 Understand the JDBC Understand the steps of the JDBC: 1.) Importing packages 2.) Opening a connection to a database 3.)
JDBC and SQLJ CIS 612 Spring JDBC JDBC is an API that enables database access from Java programs JDBC for DB access provides ◦ Portability across.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Basics of JDBC Session 14.
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
C Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Introduction to XML Standards.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Using Oracle JDBC How to Run JDBC on Your Account Communication Mechanism Using Metadata Building a Database Auto Commit v.s Atomic Transaction.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
JDBC Statements The JDBC Statement, CallableStatement, and PreparedStatement interfaces define the methods and properties that enables to send SQL or PL/SQL.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
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.
CSE202 Database Management Systems
Interacting with Database
XML: Extensible Markup Language
Web Technologies IT230 Dr Mohamed Habib.
JDBC.
XML and Databases.
XML stands for Extensible Markup Language.
Database Processing with XML
Client Access, Queries, Stored Procedures, JDBC
Interacting with Database
Java Database Connectivity
2/18/2019.
JDBC Example.
Presentation transcript:

Introduction to XML CS348 Information System Guest Lecture Hazem Elmeleegy

Outline What is XML? Syntax of XML Document DTD ( Document Type Definition ) XML Query Language XML Databases XML Schema Oracle JDBC

Introduction to XML XML stands for EXtensible Markup Language XML was designed to describe data. XML tags are not predefined unlike HTML XML DTD and XML Schema define rules to describe data XML example of semi structured data

Building Blocks of XML Elements (Tags) are the primary components of XML documents. JAMES RUSSEL Element FNAME nested inside element Author. Attributes provide additional information about Elements. Values of the Attributes are set inside the Elements Element Author with Attr id Comments stats with

XML DTD A DTD is a set of rules that allow us to specify our own set of elements and attributes. DTD is grammar to indicate what tags are legal in XML documents. c XML Document is valid if it has an attached DTD and document is structured according to rules defined in DTD.

DTD Example RICHRD KARTER <!DOCTYPE BOOKLIST[ LASTNAME(#PCDATA) > ]> Xml Document And Corresponding DTD

XML Schema Serves same purpose as database schema Schemas are written in XML Set of pre-defined simple types (such as string, integer) Allows creation of user-defined complex types

XML Schema RDBMS Schema (s_id integer, s_name string, s_status string) Allan 62 XMLSchema XML Document and Schema

XML Query Languages Requirement Same functionality as database query languages (such as SQL) to process Web data Advantages Query selective portions of the document (no need to transport entire document) Smaller data size mean lesser communication cost

XQuery XQuery to XML is same as SQL to RDBMS Most databases supports XQuery XQuery is built on XPath operators (XPath is a language that defines path expressions to locate document data)

XPath Example John 22 XPath: /Student[Name=“John”]/ Extracts: element with value

Oracle and XML XML Support in Oracle XDK (XML Developer Kit) XML Parser for PL/SQL XPath XSLT

Oracle and XML XML documents are stored as XML Type ( data type for XML ) in Oracle Internally CLOB is used to store XML To store XML in database create table with one XMLType column Each row will contain one of XML records from XML document Database Table: XML Document Database Row : XML Record

Examples John 120 Northwestern Ave Paul 120 N. Salisbury

Example Create table prTable(patientRecord XMLType); DECLARE prXML CLOB; BEGIN -- Store Patient Record XML in the CLOB variable prXML := ' John 120 Northwestern Ave ‘ ; -- Now Insert this Patient Record XML into an XMLType column INSERT INTO prTable (patientRecord) VALUES (XMLTYPE(prXML)); END;

Example TO PRINT PATIENT ID of ALL PATIENTS SELECT EXTRACT(p.patientRecord, FROM prTable p; USE XPATH

Oracle JDBC JDBC an API used for database connectivity Creates Portable Applications Basic Steps to develop JDBC Application Import JDBC classes (java.sql.*). Load JDBC drivers Connect and Interact with database Disconnect from database

Oracle JDBC DriverManager provides basic services to manage set of JDBC drivers Connection object sends queries to database server after a connection is set up JDBC provides following three classes for sending SQL statements to server Statement SQL statements without parameters PreparedStatement SQL statements to be executed multiple times with different parameters CallableStatement Used for stored procedures

Oracle JDBC SQL query can be executed using any of the objects. ( Statement,PreparedStatement,CallableStatement ) Syntax ( Statement Object ) Public abstract ResultSet executeQuery(String sql) throws SQLException Syntax ( PreparedStatement,CallableStatement Object ) Public abstract ResultSet executeQuery() throws SQLException Method executes SQL statement that returns ResultSet object (ResultSet maintains cursor pointing to its current row of data. )

Oracle JDBC (Example) Import java.sql.*; Import java.io; Class simple{ public static void main(String[] args) throws Exception{ Connection conn=null; try{ String conStr = DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); conn = DriverManager.getConnection(conStr,”username”,”passwd"); Statement cursor = conn.createStatement(); // Connection Est. ResultSet rset = stmt.executeQuery(“Select* from table_name”); while(orset.next()){ System.out.println(“Printing column name ”+orest.getStringVal(1)); } }Catch(ClassNotFoundException e){} cursor.close(); conn.close(); } }

References [1] Database Management Systems by Ramakrishnan and Gehrke

Thank You