0
Новые тенденции управления данными в продуктах компании  IBM [email_address]
Agenda <ul><li>Part I – XML:  Почему и Где </li></ul><ul><li>Part II – Native XML  в  DB2 Viper </li></ul><ul><li>Part III...
XML and Information on Demand Гибкость Запросов Files <ul><li>Возрастающая важность  XML </li></ul><ul><ul><li>Формат обме...
Типичные сценарии использования  XML <ul><li>Интеграция разрозненных источников данных </li></ul><ul><li>Обмен информацией...
Пример  1:  Финансовые данные  (FIXML) <ul><li>Покупка 1000 акций компании  IBM. </li></ul>8=FIX.4.2^9=251^35=D^49=AFUNDMG...
Почему нужно использовать  XML  с БД  ? <ul><li>Управление большими объемами это проблема для БД ! </li></ul><ul><ul><li>Э...
XML-Enabled Databases:  две опции XML DOC Извлечение определенных элементов / атрибутов Сторонние таблицы CLOB/Varchar XML...
Проблемы  XML-enabled Databases <ul><li>Хранение как  CLOB: </li></ul><ul><ul><li>Выполнение запроса  требует разбора  XML...
Нарезка :  Простой пример <DEPARTMENT  deptid=&quot;15&quot; deptname=&quot;Sales&quot;> <EMPLOYEE> <EMPNO>10</EMPNO> <FIR...
Нарезка :  Изменение схемы … <DEPARTMENT  deptid=&quot;15&quot; deptname=&quot;Sales&quot;> <EMPLOYEE> <EMPNO>10</EMPNO> <...
Зачем  native XML  хранилище ? <ul><li>Много данных в реляционных БД </li></ul><ul><ul><li>И это не будет меняться… так ка...
XML  в  DB2 DB2  с  Native XML Support SQL Developer … “ Я вижу комплексную РСУБД которая так же поддерживает  XML&quot; X...
XML  в  DB2 SQL  и  XML  одинаковы в  DB2 <ul><li>Множество интерфейсов для запросов </li></ul><ul><ul><li>SQL/XML  и  XQu...
Обзор Интерфейса <ul><li>Определение данных </li></ul><ul><li>create table  dept (deptID  int ,   deptdoc  xml ); </li></u...
Разбор документа dept name phone employee office id name phone employee office id 901 John Doe 344 408-555 1212 902 Peter ...
Хранение документа <ul><li>Иерархия узлов  XML  Документа хранится на страницах  DB2 </li></ul><ul><li>Если документ не по...
Размер страницы для хранения  XML <ul><li>Большие документы разбиваются на регионы  </li></ul><ul><li>Максимальный размер ...
Индексирование <ul><li>B-tree  индексы расширены для управления  XML  документами </li></ul><ul><li>Дополнительные поля </...
Индексирование AS  SQL  VARCHAR (integer) CREATE index-name  ON  table-name(xml-column-name) GENERATE KEY USING XMLPATTERN...
Document Retrieval using SQL <ul><li>Retrieve XML documents </li></ul><ul><li>Select i,  deptdoc  from dept </li></ul><ul>...
Поиск по документу используя  XQuery <ul><li>Полная поддержка  XQuery  и  XPath 2.0 </li></ul><ul><ul><li>Включаяя  FLWOR ...
Выражение  FLWOR <ul><li>F OR :  проходит по последовательности документов ,  </li></ul><ul><li>L ET :  привязка переменны...
Выражение  FLWOR John Doe Peter Pan <namelist> <name> John Doe </name> <name> Peter Pan </name> </namelist> <name> John Do...
XQuery  с объединением for  $book  in db2-fn:xmlcolumn('BOOKS')/book  for  $entry  in db2-fn:xmlcolumn('REVIEWS')/entry  w...
SQL/XML –  Лучшее от общих от обоих миров <ul><li>Все возможности  SQL  для обработки реляционных столбцов </li></ul><ul><...
SQL/XML <ul><li>select d.deptID, xmlquery(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“), u.empcount </li></ul><ul><...
SQL/XML –  публикация  XML  документов SELECT  XMLELEMENT  (NAME &quot;Department&quot;,  XMLATTRIBUTES  (e.department AS ...
XMLTABLE -  XML->relational SELECT X.* from  XMLTABLE   (‘ db2-fn:xmlcolumn(“PORDERS.PO”) //customer’   COLUMNS     “CID” ...
Функции публикации  SQL/XML <ul><li>Скалярные функции </li></ul><ul><ul><li>XMLELEMENT  – generate   XML element </li></ul...
JDBC API Enhancements for XML <ul><li>Поддержка нового  XML  типа </li></ul><ul><li>Поддержка нового интерфейса  com.ibm.d...
Sample Java Program <ul><li>PreparedStatement stmt1 = con.prepareStatement(&quot;Select  doc  from  dept  where id = ‘001’...
Sample Java Program – XQuery <ul><li>PreparedStatement stmt=null; </li></ul><ul><li>ResultSet rs; </li></ul><ul><li>String...
DB2.NET XML Support  <ul><li>DB2 .NET Provider </li></ul><ul><li>DB2Xml -  Инкапсулирует   тип  XML </li></ul><ul><ul><li>...
Sample .NET Program - XQuery <ul><li>DB2XmlCommand xcmd = new DB2XmlCommand(); </li></ul><ul><li>//Retrieve the name of al...
Проверка с помощью  XML Schemas <ul><li>Проверка опциональна и осуществляется на уровне документа </li></ul><ul><ul><li>Бе...
Управление  XML Schema <ul><li>Репозиторий  XML Schema (XSR) </li></ul><ul><ul><li>Хранит зарегистрированные схемы </li></...
Аннотация схемы   для Нарезки <ul><li>Отображение из  XML  в реляционные таблицы </li></ul><ul><ul><li>Отображение контрол...
<attribute name=&quot;orderID&quot; type=“xs:string“ db2-xdb:rowSet  =  “ PURCHASE_ORDER ”  db2-xdb:column  = “ ORDERID ” ...
DB2 Development Workbench <ul><li>Eclipse based </li></ul><ul><li>Support for XML type in tables, views, SPs and UDFs  </l...
XQuery Builder Java <ul><li>Graphical XQuery builder </li></ul><ul><li>Supports selecting from actual documents to build q...
MS Visual Studio .NET – DB2 XML add-in .NET <ul><li>Server Explorer  </li></ul><ul><li>XML Editor </li></ul><ul><li>XML Sc...
DB2 Viper  в  Storebrand <ul><li>Лидирующий игрок ,  на рынке страхования здоровья и жизни ,  управления активами и ценным...
Partner Solutions JustSystem
Немного о других новых возможностях <ul><li>STTM –  самонастраиваемая и конфигурируемая память  DBMS </li></ul><ul><li>LBA...
Автоматизация автоматически ! <ul><li>Включение множества автономных возможностей по умолчанию .  </li></ul><ul><li>Пример...
STMM  в действии  –  Удаление важного индекса TPCH Query 21 - After drop index - Average times for the 10 streams 0 1000 2...
Security - Label Based Access Control <ul><li>Label Based Access Control (LBAC) </li></ul><ul><ul><li>“ label”  ассоцииров...
LBAC Hierarchy Update/Read A 255 B 250 C 254 D 253 B1 100 B2 100 B1-1 50 B1-2 50 B2-3 50 A1 254 A 255 B 250 C 254 D 200 B1...
Hybrid Partitioning 999 Machines HASH RANGE 32K Partitions MDC 64G A-C 64G D-M 64G N-Q 64G R-Z
Region Year East 97 North South West 98 99 00 0th Block BID = 0-0 Pg 0 Pg 1 Pg 2 Pg 3 Pg 20 Pg 21 5th Block BID = 20-0 01 ...
Row Compression  используется  LZV John, Dept 500, 20000, Plano, TX, 24355 Компрессия множества строк в одну страницу не э...
Row Compression Using Side Tables John, Dept 500, 20000, Plano, TX, 24355, Site 3 Сторонние таблицы содержат повторяющуюся...
DB2 - More Compression Ratios (Customer Data) Compression Type 32KB Page Count Space Required on Disk No compression 58938...
Informix Dynamic Server 10
IBM Informix Dynamic Server Roadmap  <ul><li>2008 </li></ul><ul><li>Запросы рынка , Technology &  заказчиков партнеров </l...
Increase in Nightly Builds and Tests (IDS(4), CSDK, GLS, 4GL) 57000 4000 74 4
IDS  Уменьшение кол-ва ошибок 2001  2002  2003  2004 IDS 9.21 IDS 9.30 Defect   Backlog 9.30.UC7 – 250 fixes 7.31.UD7 7.31...
IBM Software Portfolio –  использование компонентов Общие  возможности Общие  комопоненты Инвестиции В продукты Начальные ...
 
Upcoming SlideShare
Loading in...5
×

Презентация Microsoft PowerPoint

672

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
672
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • XML is a central to our Information on Demand strategy and DB2 Viper’s native XML support is a keystone. Information services will often carry and exchange XML. DB2 Viper can publish information as XML, transform information to create new XML documents and store XML documents intact, including digital signatures. The native XML capabilities of DB2 Viper address the needs of customers for XML data management enabling them to build information services and deploy information on demand
  • IBM has invested heavily to add native support for XML to DB2. The term native is being used by both MS and Oracle and is becoming overloaded, but DB2 is the only database that offers storage designed for hierarchical XML documents. In many ways, the addition of XML support to DB2 makes it a hybrid database, capable of storing and managing both structured and semi-structured information. The depth of enabling through all layers of the engine makes it possible to blend together traditional relational information and XML documents. This allows developers to design and deploy their applications in the right way, without compromises while ensuring that their application data can be integrated with the rest of the business. New and existing applications that mainly manage traditional relational types can easily manage XML while being able to join and query across both traditional types and XML without being forced to store the XML in traditional types. New applications that manage XML can easily access existing relational data using SQL/XML publishing functions to create XML documents and the XML they store can be integrated with traditional data from other applications. Both development communities will see a first class database.
  • Now we start to take a look at the technology. We have engineered XML support throughout the different layers of DB2 from the API’s, tools and utilities, through the engine, optimizer and indexing technologies, right down to the storage layer where we store XML documents in their natural form directly on DB2 pages. While revolutionary in its capabilities, customers will find it’s an evolutionary change for their applications, which can now store and manage XML using existing API’s XQuery is the standard (W3C Last Call) for querying XML data. SQL/XML (ANSI ISO) provides XML publishing functions for traditional relational data and allows you to embed XQuery within SQL so you can access, join and filter on a combination of data types, both relational and XML. SQL/XML also defines a function that allows you to publish XML elements as relational fields that can be used with SQL. The power of SQL/XML and our deep enabling of XML make DB2 Viper a true hybrid database. We will take a look at each aspect of support on the following pages. “ Native” means that XML documents are stored on disk pages in tree structures matching the XML data model. This avoids the mapping between XML and relational structures, and the impedance mismatch. XML is now a first-class data type in DB2, just like any other SQL type. XML data type can be used in a “create table” statement to define one or more columns of type XML. Since XML has no different status than any other types, tables can contain any combination of XML and relational columns. A column of type XML can hold one well-formed XML document for every row of the table. The NULL value is used to indicate the absence of an XML document. Though, every XML document is logically associated with a row of a table, XML and relational columns are stored differently. Relational and XML data are stored in different formats that match their respective data models. XML schema is not required in order to define an XML column or to insert or query XML data. An XML column can hold schema-less documents as well as documents for many different or evolving XML schemas. Schema validation is optional on a per-document basis. Thus the association between schemas and documents is per document and not per column, which provides maximum flexibility. Unlike a varchar or a CLOB type, the XML type has no length assoc with it. Currently, only the client-server communication protocol limits XML bind-in and bind-out to 2GB per doc. With very few exceptions, this is acceptable for all XML applications. The XML type can be used not only as a column type but also as a datatype for host variables in languages such as C, Java and COBOL. XML type is also allowed for parameters and variables in SQL stored procedures, UDFs and external stored procs written in C and Java. Advantages – Any update affects only the nodes that are being changed and their immediate ancestor, siblings and descendants Access to any portion of the document can be direct, w/o requiring a read of the whole document Indexing is based on collections rather than byte offset into a document-level byte stream; index entries must be changed only for relocated nodes, not for all the nodes that follow in an in-order traversal Concurrency control is possible at the subdocument level Different ways to manage XML documents exists. These include shredding into relational tables or just storing them as CLOBs. In DB2 Native XML, XML data is stored in a parsed, annotated tree form, similar to the DOM. The XML data is formatted to data pages which are buffered. The benefits of this format include faster navigation which results in faster query execution as well as simpler indexing of data.
  • First the basics. To create a table which includes an XML column, you use the create table statement, specifying column name with the type XML. You insert documents into the table using insert statements as usual. You can bind parameter markers to streams or character fields. In most cases, parsing the XML is implicit, but for those cases where you need to explicitly call for parsing, such as when you write the XML directly into the insert statement, you use the XMLPARSE keyword You can also use IMPORT to insert XML documents into the table You use the create index statement to create an index over an XML column. While traditional relational types hold a single value in each row of each column, XML columns can hold complex types, so you need to be able to specify which elements to index. You do this with the xmlpattern keyword for which you specify a simple XPath expression. The XPath expression is a simple path to the elements to be indexed, you cannot use predicates. You also specify want the type you want the index to treat the element as. You should choose the type based on how the element is accessed in queries. If it’s queried as a text field, use character types, if it’s queried as a numeric field, use numeric types. You can retrieve complete documents using simple SELECT expressions which can include predicates on relational fields. You can select a mixture of relational fields and XML documents and you can join on relational fields using simple SQL. When you need to query relational fields and the contents of the XML documents you use SQL/XML with embedded xmlquery (XQuery) expression. Now you can query relational fields and XML elements, join and apply predicates to both the relational and XML data.types.
  • Inserted documents are parsed into XQuery Data Model (XDM). http://www.w3.org/TR/2005/CR-xpath-datamodel-20051103/#intro The XQuery data model describes the inputs, outputs and intermediate values that occur during the processing of a query. This includes: Simple Typed Values, Seven types of Nodes, Sequences, Query Expressions, Constants and Variables, Operators and Path Expressions. Inserted documents must be well formed with respect to the XQuery Data Model. To improve storage efficiency, strings are parsed out and stored in a catalog table. To improve query efficiency, path information is stored in a catalog table
  • The parsed document is stored on DB2 pages. If a document is too big to fit onto a single page, sub-tree’s (regions) of the document are stored on different pages. The system maintains a Regions Index so the complete document can be efficiently retrieved. Note that DB2 is storing the document in native form. No mapping is taking place. The document is parsed and stored in XML form, maintaining the XML tree structure.
  • DB2 indexing has been enhanced and extended to efficiently index XML documents. Indexes are created on columns of type XML based on path expressions. When creating an index you specify the path to index and the type. A single document may contain zero, one or multiple nodes that match the xmlpattern, so there might be zero, one or multiple index entries for a single row in a table. This is significantly different to indexes on relational columns. Any nodes that match the path expression and type are indexed. The index points to the node in storage. That node is linked to its parent and children for fast navigation. Unlike traditional relational indexes where index keys are composed of one or more table columns specified by the user, XML indexes use the XML pattern expression to index paths and values in XML documents stored in a single XML column. The index can also fill in default attribute and element values from the schema at insertion time if the values are not specified in the document. Index entries contain document node position information. As a result, the index can quickly provide direct access to the nodes within a document and avoid a document traversal. In addition, because the index has this document node position information, it understands the hierarchy in the document and can perform containment tests. The index knows which child nodes belong to the same ancestor and can do appropriate filtering. For example, the index can return only the employees that have child node Lastname = &apos;Smith&apos; and attribute node of @gender = &apos;Female&apos;. Applications that manage millions of XML docs are not uncommon. Strong indexing is required to provide high query performance. DB2 supports path-specific indexes on XML columns so that elements and attributes frequently used in predicates and cross-document joins can be indexed. As well as extended and enhanced indexing for XML, DB2 also has a new Pivot Join technique that enhances performance by concurrently evaluate predicates using multiple cursors.
  • As you can see, indexes are created using the CREATE INDEX statement as you would for traditional types. In addition to the syntax you are used to, you specify which elements and attributes are to be indexed using a simple XPath expression and you specify the type to be used. Elements and attributes inside the documents that are frequently used in predicates and cross-document joins can be indexed. You specify what paths to index and the type that you will use in your queries. If a node matches the xmlpattern but fails to cast to the specified index type, then no index entry is created for the node. This does not raise an error. An example: CREATE INDEX IDX1 ON dept (deptdoc) GENERATE KEY USING XMLPATTERN &apos; /dept/employee/name &apos; AS SQL VARCHAR(35); This statement defines an index on all employee names in all documents in the XML column “deptdoc”. The xmlpattern is a path which identifies the XML nodes to be indexed. It is called xmlpattern and not xpath because only a subset of the XPath language is allowed in index definitions. (Wildcards //,* and namespaces are allowed but XPath predicates such as /a/b[c=5] are not supported. Because DB2 does not force you to use a single XML schema for all documents in an XML column, it may not know which data type to use in the index for a given xmlpattern, so the user must specify the datatype explicitly using the “as sql &lt;type&gt;” clause. The following types can be used - VARCHAR(n) – for nodes with values of a known maximum length VARCHAR HASHED – for nodes with values of arbitrary length. In this case, the index contains hash values of the actual strings. Such an index can be used for equality predicates but not for range predicates. DOUBLE – for nodes with any numeric type DATE and TIMESTAMP – for nodes with corresponding XML values.
  • Full documents can be retrieved using simple SELECT statements. The full power of SQL is available, but you can only retrieve complete documents.
  • To query the contents of stored XML documents, you will use XQuery. XQuery is a W3C Candidate Recommendation for a query language that can be used across a range of XML data sources - http://www.w3.org/TR/xquery/ Because XQuery is designed to have broad application, the standard definition operates on a collection of documents, but does not assume any particular interface. This may change, but in the meantime, we have implemented two DB2 functions that bind XQuery to an XML column or to a collection of XML documents returned by a SQL Select expression XQuery is a very powerful declarative query language which can be used to both query and transform XML. It makes use of XPath, an expression language used to select parts of an XML document. XPath is often used with XSLT to select and transform XML documents. XQuery goes beyond the simple data selection of XPath by adding the FLWOR expression. Pronounced ‘flower’, the acronym comes from the keywords F or, L et, W here, O rder by and R eturn that make up a FLWOR expression.
  • For is an iterator, iterating over a collection of XML documents Let allows variable assignments. All variable names start with $ The for and let clauses specify a sequence of tuples Where filters the sequence of tuples Order orders the remaining tuples Return declares what should be returned, it executes once for every remaining tuple, in order. In the example above: FOR binds the variable $movie to the xml column movies in table 1 and iterates over this set of documents. LET assigns a sequence of actor nodes to the variable $actors WHERE filters the documents to include only those with duration &gt; 90 ORDER by sorts the documents by the attribute year RETURN constructs a new &lt;movie&gt; element with children &lt;title&gt; and the sequence of &lt;actor&gt; elements from the $actors variable
  • From http://www.sqlx.org/ SQL and XML Working Together SQL/XML is an ANSI and ISO standard that provides support for using XML in the context of an SQL database system. Because SQL is the standard language for accessing and managing data stored in relational databases, it is natural that enterprises and users worldwide need the ability to integrate their XML data into their relational data through the use of SQL facilities. SQL/XML makes it possible to store your XML documents in your SQL database, to query those documents using XPath and XQuery, and to &amp;quot;publish&amp;quot; your existing SQL data in the form of XML documents. Capabilities of SQL/XML include: Combined use of SQL and XQuery XPath including joining and predicates Publishing functions to publish new XML documents created from relational fields Can also publish documents that are created from a mix of relational fields and XML fragments returned from XQuery XMLTable to materialize XML elements as tables The example shows the power of SQL/XML, mixing SQL and XQuery XPath for retrieval, joins and predicates. We will look at an example in more detail next
  • In this example, we have a Dept table with an XML column and a Unit table containing traditional data We need to query department ID, department name and unit headcount, like this: deptID Name Unit empcount 100 Engineering 234 We are only interested in named departments from units with more than 200 employees that are currently housed in the units primary building. deptID comes straight from the Dept table, department name is an element within the XML document and headcount comes from the Unit table. To query depatment name from the XML documents, we use this SQL/XML XQuery expression xmlquery(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“) We join the Dept and Unit tables as usual and apply the predicate on unit headcount where d.unitID = u.unitID and u.empcount &gt; 200 To find departments housed in the units primary building we apply an equality test across the bldg attribute in the XML document and the bldg column in the unit table xmlquery(‘$deptdoc/dept/@bldg’ passing d.deptdoc as “deptdoc“) = u.bldg To filter out anonymous departments we use the XMLExists SQL/XML expression xmlexists(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“) The example demonstrates the power of SQL/XML to query, join and filter across both traditional fields and XML documents.
  • Another powerful feature of SQL/XML is the XML publishing functions which allow you to create XML documents from traditional relational fields. In this example we have a table containing 3 columns. We want to publish some of this information as XML in the form of a list of departments with employee first names as child elements. We use the SQL/XML function XMLELEMENT to create the Department tags &lt;Department&gt; &lt;/Department&gt; XMLELEMENT (NAME &amp;quot;Department&amp;quot; Within the XMLELEMENT function we use XMLATTRIBUTES to add the name attribute to the Department element. By pointing at the column e.department, we use data from the department column for the attribute value. XMLATTRIBUTES (e.department AS &amp;quot;name&amp;quot; ) Still within the Department tag, we create a sequence of &lt;emp&gt; elements defined by XMLELEMENT and populated based on the firstname column. XMLELEMENT (NAME &amp;quot;emp&amp;quot;, e.firstname) These are grouped using XMLAGG XMLAGG ( XMLELEMENT (NAME &amp;quot;emp&amp;quot;, e.firstname))
  • XMLTABLE – Constructs a table from an XML document XMLTable, allows users to convert portions of XML documents (or any XML data value) into table values within SQL query expressions. Return results from XML docs as rows and columns This is like shredding but in one table only. XMLTable - XPath version: Generate relational rowsets from XML (to leverage query processing in SQL) Using XPath expressions to find rows and columns In the future we will also look into, providing XQuery expressions to locate rows and columns. Explanation of the query po is an XML column in the PORDERS table What we want to construct is a table with columns CID, Name, Zip Type, Zip. The values of these columns come from the following paths in XML doc. These values are being bound to the 4 columns. CID is an integer whose value comes from the attribute ID and that attribute is on element customer which is in the document $po and that document is in column po in table PORDERS.
  • This is a more complete list of the SQL/XML functions. We have already seen XMLELEMENT and XMLATTRIBUTES being used. XMLForest constructs sequences of XML elements from SQL expressions, it is an easy way to do the same as a series of XMLElement function calls XMLCONCAT constructs an XML element from pieces of independently constructed XML. XMLAGG we have seen before, it works across multiple rows XMLTABLE allows you to materialize a table from elements of XML documents. Uses XPATH expression to define the elements to materialize SELECT X.* FROM orders P, XMLTABLE (‘$order//customer’ PASSING P.orders AS “order” COLUMNS “CID” INTEGER PATH ‘@id’, “Name” VARCHAR(30) PATH ‘name’, “Zip” VARCHAR(6) PATH ‘zip’ ) AS “X”
  • Type Code java.sql.Types.OTHER until a new JDBC standard type such as java.sql.Types.XML getDB2String () Retrieves the value of the designated column in the current row of this ResultSet object as a string getDB2XmlString () Retrieves the value of the designated column in the current row of this ResultSet object as a string with added xml declaration with encoding tag &amp;quot;ISO-10646-UCS-2”. getDB2Bytes () Retrieves the value of the designated column in the current row of this ResultSet object as UTF-8 encoded bytes. getDB2XmlBytes (String targetEncoding) Retrieves the value of the designated column in the current row of this ResultSet object as a byte array with the xml declaration with encoding tag. getDB2AsciiStream () Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters getDB2XmlAsciiStream () Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters. getDB2CharacterStream () Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object. getDB2XmlCharacterStream () Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object with xml declaration with encoding tag &amp;quot;ISO-10646-UCS-2”. getDB2BinaryStream () Retrieves the value of the designated column in the current row of this ResultSet object as a UTF-8 encoded binary stream. getDB2XmlBinaryStream (String targetEncoding) Retrieves the value of the designated column in the current row of this ResultSet object as a binary stream. The driver converts the bytes to the targetEncoding and adds xml declaration with encoding tag.
  • The DB2 .NET Data Provider supports the DB2 XML data type as follows. The new DB2Xml class is a container for the DB2 XML type. DB2Xml objects can only be created from columns of type XML. The standard column retrieval (DB2DataReader) and parameter (DB2Parameter) objects can now accept XML data and enable the creation of DB2Xml objects from existing character or binary columns that contain XML data. Specifically, the DB2DataReader.GetXmlReader method is used to retrieve XML data from Char and Binary columns. The DB2Connection and DB2DataReader classes now include methods to register and retrieve XML schemas from DB2. The XmlReader class is an abstract base class that provides non-cached, forward-only, read-only access. The XmlReader class checks that the XML is well-formed, and throws XmlExceptions if an error is encountered. It can read a stream or a document, and it implements the namespace requirements outlined in the recommendation provided by the W3C located at www.w3.org/TR/REC-xml-names XPathDocument: Provides a fast, read-only cache for XML document processing using XSLT.
  • By default, DB2 will not validate against a schema when a document is inserted. To cause a document to be validated you use the xmlvalidate keyword in the insert statement. When you choose to validate, you can either do this based on the schema referenced in the document, or a schema of your choosing. According to the XML Schema standard, xml documents can use the xsi:schemaLocation tag to indicate the URI of the associated schema. DB2 can use this hint to match the right schema in the XSR using the schemalocation that was speified on the REGISTER or ADD command or procedure call. If you want to override the hint provided in the document, or make sure that a particular document is always validated using a particular schema, then you can spcify the schema to use either by the SQL 2 part name, or by URI. Notice that this gives application developers a lot of flexibility in how they manage document validation. At the extreme, you could put all your XML documents of all different types in one column in one table and still have them validated against the correct schema. We do not recommend this, but we have made sure that we have not limited implementation options. This is important because one of the strengths of XML is how quickly and easily it can be changed to handle new business requirements.
  • XML Schemas define the legal building blocks of an XML document. XML Schemas define the elements and attributes that can appear in a document, the parent child relationships between elements, the order of elements, the number of elements, the data type of elements, element content restrictions, which elements are required or optional and any default values XML Schemas can be used to validate documents when they are inserted. Validation is optional and controlled by the calling application. The XML Schema repository is a place to store XML schemas that DB2 applications will use. The repository is managed as part of the DB2 Catalogs. There are stored procedure and command line interfaces into the XSR. XML schemas are identified in several ways: by a SQL 2-part name, by the URI the Schema is externally known as (e.g. used in schemaLocation attributes) and by the primary namespace The first step in the process is to register a schema with the repository using XSR_REGISTER. The parameters to this function are: rschema the relational schema part of the SQL 2 part name name the name part of the SQL 2 part name schemalocation the external URI content the primary XML Schema document docproperty a set of schema properties express as an XML document To make it easier to manage and reuse common definitions across schemas, the XML Schema standard (W3C http://www.w3.org/XML/Schema) allows schemas to include other schemas using an include tag. This means a complete schema in the XSR may be made up of several documents. You use the XSR_ADDSCHEMADOC interface to add secondary schemas to a registered schema. The parameters are the same as XSR_REGISTER When a schema is ready to be used for validation, you make it available by calling XSR_COMPLETE. The parameters are: rschema the relational schema part of the SQL 2 part name name the name part of the SQL 2 part name schemaproperties a set of schema properties express as an XML document issuedforshred set to 1 if this schema is annotated for shredding. We haven’t covered shredding yet…
  • Now we very quickly deal with shredding. When you complete the process of adding a schema to the XSR, one of the parameters to XSR_COMPLETE was isusedforshred Shredding involves looking at the XML data, defining a corresponding relational schema (for example, looking at parent/child relationships in the XML data and representing each child as one or more tables in a referential integrity constraint with its parent) and defining a mapping from the XML data to the relational schema. That mapping might be manually defined, programmatically defined (most frequently using XML schema as input) or defined by some combination of automatic programming followed by manual editing for fine-tuning. By annotating the schema with tags that define the mapping to relational tables, you can direct DB2 to carry out the shredding.
  • Attribute “orderID” is shredded in 2 tables/columns: PURCHASE_ORDER and ELECTRONICITMES
  • Preview XML column data in a table or view by itself or along with other relational column data Filter based on XPath, XQUERY or SQLXML expression Drag and drop to winforms and webforms Import/Export XML data from/to a file system (support multiple XML documents import/export) Update XML column while doing preview data New DB2 .NET add-in XML data editor allow user to easily modify the XML data Bind XML column from your table to DB2 .NET add-in XML data editor, allowing your application to embed our XML data editor for updating and retrieving XML column data in your table.
  • Storebrand have been working with the DB2 team throughout the Alpha and have presented their results at several conferences with us. They have put the Alpha to work and tested a number of scenarios. They are continuing to work with us in the Beta. The results at Storebrand confirm the productivity improvements, cost savings and improved performance that customers will benefit from when they use DB2 Viper’s native XML capabilities to store and manage their XML documents.
  • A growing community of partners are exploiting DB2 Viper’s XML capabilities. Exegenix – provide an on-line document conversion service Embarcadero – database tools MDXSYS – XMLObjective editor JustSystem – XFY xml application development XAware – Services Oriented Integration Temenos – Banking solutions Nextance – Contract Management Skytide – OLAP Analytics for XML data StreamServe – content publishing
  • MDC tables are just tables ! For example, you can create RID indexes on MDC tables (as shown in the 2nd example on this slide). Note also that, because BIDs and RIDs have the same format, we can do ANDing and ORing operations that combine BID and RID indexes (again as shown in the 2nd example).
  • % Pages saved is calculated as: 100 * (Uncompressed Size - Compressed Size) / (Uncompressed Size) &lt;-- Bigger is better
  • NOTE TO SPEAKER: This slide is animated, so will take multiple key strokes as each product version populates separately. Start this slide off with point from previous slide that will no longer be used: Informix database servers continue to receive significant development investment at IBM This slide shows themes of upcoming releases of IDS. The arrow continues past 9.6. IDS development will continue! We plan beta testing of IDS 9.4 in Q3 of 2002, with general availability early next year. In 9.4, we’ve finally eliminated the 2 gigabyte limit on chunk sizes. Also, all remaining 2 Gig file limits in utility output will be removed.   UPDATED – these are the ones that Sue Riley and Michael Hiskey agreed to 8/19/03 IBM’s plans for the Informix enterprise product portfolio: Ongoing investment for existing customers and partners for as long as they require Planned releases approximately every 18 months IDS investment exceeds level prior to acquisition. Arrowhead engineers were added to DB2 and back to IDS. (Also many joined the Storage division.) More details in the upcoming slides …
  • Builds and tests include IDS products 7.31, 9.30, 9.40 and IDS 9.50 and CSDK and 4GL. Builds – 4 (2000), 10 (2001), 37 (2002), 74 (2003) Tests – 4000 (2000), 7000 (2001), 37000(2002), 57000(2003)
  • Thank you for taking the time to listen to this teleconference.
  • Transcript of "Презентация Microsoft PowerPoint"

    1. 1. Новые тенденции управления данными в продуктах компании IBM [email_address]
    2. 2. Agenda <ul><li>Part I – XML: Почему и Где </li></ul><ul><li>Part II – Native XML в DB2 Viper </li></ul><ul><li>Part III – Немного о других новых возможностях DB2 Viper </li></ul><ul><li>Part III – Informix Dynamic Server 10 </li></ul><ul><li>Part IV – Вопросы и ответы </li></ul>
    3. 3. XML and Information on Demand Гибкость Запросов Files <ul><li>Возрастающая важность XML </li></ul><ul><ul><li>Формат обмена документами </li></ul></ul><ul><ul><li>Web Services </li></ul></ul><ul><ul><li>Обмен метаданными </li></ul></ul><ul><ul><li>Модель программирования </li></ul></ul><ul><li>Глубокая XML интеграция упрощает и объединяет инфраструктуру </li></ul><ul><ul><li>Объединяет данные и Content </li></ul></ul><ul><ul><li>Расширяет использование активов </li></ul></ul><ul><li>Native XML хранилище </li></ul><ul><ul><li>Оптимизация производительности </li></ul></ul><ul><ul><li>Предоставление гибкости </li></ul></ul><ul><ul><li>Поддержка природы XML </li></ul></ul><ul><ul><li>Сервисы БД </li></ul></ul><ul><li>XQuery and/or SQL </li></ul><ul><li>XML and/or Relational Data </li></ul>Обмен XML документами XML Столбцы В RDBMS Репозитории контента Иерархические БД Реляционные БД Цифровой Content ПроизводительностьМасштабируемость , Доступность Безопасность … Гибридные возможности гибкая инфраструктура XML БД Независимость приложений Эволюция комплексных схем Последовательности и иерархии
    4. 4. Типичные сценарии использования XML <ul><li>Интеграция разрозненных источников данных </li></ul><ul><li>Обмен информацией между приложениями и организациями </li></ul><ul><li>eForms и системы workflow </li></ul><ul><li>Управление наполнением и документами </li></ul><ul><li>Транзакции основанные на сообщениях , web services, SOA </li></ul><ul><li>XML документы как бизнес объекты / транзакционные записи ( цифровая подпись , аудит, соответствие регулирующему законодательству ) </li></ul><ul><li>XML как модель данных лучше подходит для ( множественных значений, иерархий и комплексных данных ) </li></ul>
    5. 5. Пример 1: Финансовые данные (FIXML) <ul><li>Покупка 1000 акций компании IBM. </li></ul>8=FIX.4.2^9=251^35=D^49=AFUNDMGR^56=ABROKER^34=2 ^52=20030615-01:14:49^11=12345^1=111111^63=0^64=2003 0621^21=3^110=1000^111=50000^55=IBM^48=459200101^22= 1^54=1^60=2003061501:14:4938=5000^40=1^44=15.75^15=USD ^59=0^10=127 <ul><li>Новый FIXML </li></ul><ul><li>протокол </li></ul><ul><ul><li>Расширяемый </li></ul></ul><ul><ul><li>Снижает затраты на поддержку и разработку </li></ul></ul>Старый протокол FIX
    6. 6. Почему нужно использовать XML с БД ? <ul><li>Управление большими объемами это проблема для БД ! </li></ul><ul><ul><li>Эффективный поиск и извлечение XML </li></ul></ul><ul><ul><li>ACID </li></ul></ul><ul><ul><li>Производительность , Масштабируемость </li></ul></ul><ul><ul><li>… те же причины что и для реляционных данных ! </li></ul></ul><ul><li>Интеграция </li></ul><ul><ul><li>Интеграция новых XML данных с существующими реляционными данными </li></ul></ul><ul><ul><li>Публикация ( реляционных) данных как XML </li></ul></ul><ul><ul><li>Поддержка для web приложений , SOA, web служб (SOAP) </li></ul></ul>
    7. 7. XML-Enabled Databases: две опции XML DOC Извлечение определенных элементов / атрибутов Сторонние таблицы CLOB/Varchar XML DOC XML DOC XML DOC XML DOC varchar CLOB Фиксированное отображение Shredder (regular tables for faster lookup) Обычные таблицы “ Decompositon” Shredding
    8. 8. Проблемы XML-enabled Databases <ul><li>Хранение как CLOB: </li></ul><ul><ul><li>Выполнение запроса требует разбора XML ( Parsing ) – медленно ! </li></ul></ul><ul><li>Нарезка : </li></ul><ul><ul><li>Отображение из XML в реляционные таблицы часто слишком сложно </li></ul></ul><ul><ul><li>Часто требует десятки, а то и сотни таблиц </li></ul></ul><ul><ul><li>Требуются сложные Complex разнонаправленные соединения( joins ) для восстановления XML документа </li></ul></ul><ul><ul><li>При изменение схемы XML ломается mapping </li></ul></ul><ul><ul><ul><li>Нет гибкости в схеме ! </li></ul></ul></ul><ul><ul><ul><li>Например : изменение элемента, теперь он может встречаться в документе один и более раз. Это требует нормализации реляционной схемы и данных </li></ul></ul></ul>
    9. 9. Нарезка : Простой пример <DEPARTMENT deptid=&quot;15&quot; deptname=&quot;Sales&quot;> <EMPLOYEE> <EMPNO>10</EMPNO> <FIRSTNAME>CHRISTINE</FIRSTNAME> <LASTNAME>SMITH</LASTNAME> <PHONE>408-463-4963</PHONE> <SALARY>52750.00</SALARY> </EMPLOYEE> <EMPLOYEE> <EMPNO>27</EMPNO> <FIRSTNAME>MICHAEL</FIRSTNAME> <LASTNAME>THOMPSON</LASTNAME> <PHONE>406-463-1234</PHONE> <SALARY>41250.00</SALARY> </EMPLOYEE> </DEPARTMENT>
    10. 10. Нарезка : Изменение схемы … <DEPARTMENT deptid=&quot;15&quot; deptname=&quot;Sales&quot;> <EMPLOYEE> <EMPNO>10</EMPNO> <FIRSTNAME>CHRISTINE</FIRSTNAME> <LASTNAME>SMITH</LASTNAME> <PHONE>408-463-4963</PHONE> <PHONE>415-010-1234</PHONE> <SALARY>52750.00</SALARY> </EMPLOYEE> <EMPLOYEE> <EMPNO>27</EMPNO> <FIRSTNAME>MICHAEL</FIRSTNAME> <LASTNAME>THOMPSON</LASTNAME> <PHONE>406-463-1234</PHONE> <SALARY>41250.00</SALARY> </EMPLOYEE> </DEPARTMENT> <ul><li>Требует : </li></ul><ul><li>Нормализации текущих данных ! </li></ul><ul><li>Изменение отображения </li></ul><ul><li>Изменения приложения </li></ul>Costly!
    11. 11. Зачем native XML хранилище ? <ul><li>Много данных в реляционных БД </li></ul><ul><ul><li>И это не будет меняться… так как SQL DBs быстрые </li></ul></ul><ul><li>XML формат обмена </li></ul><ul><ul><li>Web Services везде </li></ul></ul><ul><li>XML как артефакт транзакции </li></ul><ul><ul><li>Все больше и больше данных представляются в формате XML с самого начала … </li></ul></ul><ul><li>Держать XML как XML </li></ul><ul><ul><li>Каждая трансформация ( нарезка ) затратка </li></ul></ul><ul><ul><li>И потенциально ведет к потерям информации </li></ul></ul><ul><ul><li>XML может быть слишком сложным для нарезки </li></ul></ul><ul><ul><li>Иерархический XML более адаптирован к человеческому мышлению </li></ul></ul>
    12. 12. XML в DB2 DB2 с Native XML Support SQL Developer … “ Я вижу комплексную РСУБД которая так же поддерживает XML&quot; XML Developer … “ Я вижу комплексный XML репозиторий XML который так же поддерживает SQL&quot; XML интегрирован во все аспекты DB2! XML
    13. 13. XML в DB2 SQL и XML одинаковы в DB2 <ul><li>Множество интерфейсов для запросов </li></ul><ul><ul><li>SQL/XML и XQuery </li></ul></ul><ul><ul><li>Оба языка имеют полный доступ ко всем хранимым данным </li></ul></ul><ul><ul><li>Выбор представления данных которое больше подходит для приложения </li></ul></ul><ul><li>XML возможности встроены в DB2 </li></ul><ul><ul><li>Глубока интеграция XML подразумевает высокую производительность ! </li></ul></ul><ul><li>Оптимизированное хранение данных </li></ul><ul><ul><li>Новое хранилище и индексы для XML </li></ul></ul>Сервер Клиент SQL/XML XQuery DB2 Engine XML Interface Relational Interface Relational XML DB2 Storage: DB2 Client / Customer Client Application
    14. 14. Обзор Интерфейса <ul><li>Определение данных </li></ul><ul><li>create table dept (deptID int , deptdoc xml ); </li></ul><ul><li>Вставка </li></ul><ul><ul><li>insert into dept ( deptID, deptdoc) values ( ?,?) </li></ul></ul><ul><li>Индексирование </li></ul><ul><li>create index xmlindex1 on dept (deptdoc) </li></ul><ul><li>generate key using xmlpattern ‘/dept/name’ as varchar(30); </li></ul><ul><li>Извлечение </li></ul><ul><li>select deptdoc from dept where deptID = ? </li></ul><ul><li>Запросы </li></ul><ul><ul><li>select deptID, xmlquery ('$d/dept/name' passing deptdoc as “d&quot;) </li></ul></ul><ul><ul><li>from dept where deptID <> “PR27”; </li></ul></ul>
    15. 15. Разбор документа dept name phone employee office id name phone employee office id 901 John Doe 344 408-555 1212 902 Peter Pan 216 408-555 9918 SYSIBM.SYSXMLPATHS <ul><li>XML Documents парсится в соответствии с </li></ul><ul><li>XQuery Data Model </li></ul><ul><li>Создаются дополнительная информация в каталоге </li></ul><ul><ul><li>Строки и пути хранятся в каталоге DB2 </li></ul></ul><ul><ul><li>Компрессия строк сохраняет место </li></ul></ul>SYSIBM.SYSXMLSTRINGS 0 dept 4 employee 1 name 5 id 2 phone 3 office String table 0 / 1 /0 2 /0/4 3 /0/4/5 4 /0/4/1 5 /0/4/2 6 /0/4/3 Path table
    16. 16. Хранение документа <ul><li>Иерархия узлов XML Документа хранится на страницах DB2 </li></ul><ul><li>Если документ не помещается на одну страницу он разбивается на страницы / регионы </li></ul><ul><li>Управляемый системой индекс регионов указывает на части документа </li></ul>page page page Regions index
    17. 17. Размер страницы для хранения XML <ul><li>Большие документы разбиваются на регионы </li></ul><ul><li>Максимальный размер документа 2 GB </li></ul>
    18. 18. Индексирование <ul><li>B-tree индексы расширены для управления XML документами </li></ul><ul><li>Дополнительные поля </li></ul><ul><ul><li>PATHID: путь к значению </li></ul></ul><ul><ul><li>VALUE: индексированное значение </li></ul></ul><ul><ul><li>DOCID: Идентификатор документа </li></ul></ul><ul><ul><li>NODEID: узел в котором хранится значение </li></ul></ul><ul><li>Дополнительные техники при поиске по индексам </li></ul><ul><ul><li>Pivot Join ( Zig-Zag join) </li></ul></ul><ul><ul><li>Конкурентная проверка предикатов “and” и “or” </li></ul></ul><ul><ul><li>Множество курсоров на индексе каждый проверяет предикат </li></ul></ul><ul><li>… </li></ul><ul><li>A=4, docid=2 </li></ul><ul><li>A=5, docid=3 </li></ul><ul><li>A=5, docid=4 </li></ul><ul><li>A=5, docid=5 </li></ul><ul><li>A=5, docid=7 </li></ul><ul><li>A=5, docid=8 </li></ul><ul><li>A=5, docid=9 </li></ul><ul><li>A=5, docid=10 </li></ul><ul><li>A=5, docid=11 </li></ul><ul><li>A=5, docid=12 </li></ul><ul><li>… </li></ul><ul><li>… </li></ul><ul><li>B=6, docid=1 </li></ul><ul><li>B=6, docid=2 </li></ul><ul><li>B=6, docid=6 </li></ul><ul><li>B=6, docid=12 </li></ul><ul><li>… </li></ul>Find docids where x/y[A=5 and B=6]
    19. 19. Индексирование AS SQL VARCHAR (integer) CREATE index-name ON table-name(xml-column-name) GENERATE KEY USING XMLPATTERN xmlpattern UNIQUE INDEX DOUBLE DATE TIMESTAMP VARCHAR (HASHED) xmlpattern : xmlpattern XPath без предиката create index idx1 on dept(deptdoc) generate key using xmlpattern '/dept/employee/name' as sql varchar(35) text() @attribute-tag @ * / // element-tag * / //
    20. 20. Document Retrieval using SQL <ul><li>Retrieve XML documents </li></ul><ul><li>Select i, deptdoc from dept </li></ul><ul><li>Retrieve some XML documents based on SQL Predicate </li></ul><ul><li>Select deptnum, deptdoc from dept </li></ul><ul><ul><li>Where deptnum like ‘PR%’ </li></ul></ul>
    21. 21. Поиск по документу используя XQuery <ul><li>Полная поддержка XQuery и XPath 2.0 </li></ul><ul><ul><li>Включаяя FLWOR встроенный ( nested) FLWOR </li></ul></ul><ul><li>XQuery по всем документам в столбце </li></ul><ul><ul><li>FOR $d in db2-fn:xmlcolumn (‘dept.deptdoc’)… </li></ul></ul><ul><li>XQuery по документам используя SQL предикаты </li></ul><ul><ul><li>FOR $d in db2-fn:sqlquery (“select deptdoc from dept </li></ul></ul><ul><ul><li>where deptID LIKE ‘PR%’ ”)… </li></ul></ul>
    22. 22. Выражение FLWOR <ul><li>F OR : проходит по последовательности документов , </li></ul><ul><li>L ET : привязка переменных к элементам </li></ul><ul><li>W HERE : фильтрация элементов итерации </li></ul><ul><li>O RDER : перегруппирует элементы итерации </li></ul><ul><li>R ETURN : конструирует результаты запроса </li></ul>FOR $movie in db2-fn:xmlcolumn (‘table1.movies’) LET $actors := $movie//actor WHERE $movie/duration > 90 ORDER by $movie/@year RETURN <movie> {$movie/title, $actors} </movie> <movie> <title>Chicago</title> <actor>Renee Zellweger</actor> <actor>Richard Gere</actor> <actor>Catherine Zeta-Jones</actor> </movie>
    23. 23. Выражение FLWOR John Doe Peter Pan <namelist> <name> John Doe </name> <name> Peter Pan </name> </namelist> <name> John Doe </name> <name> Peter Pan </name> <ul><ul><li>for $d in xmlcolumn(‘deptdoc’)/dept </li></ul></ul><ul><ul><li>where $d/@bldg = 101 </li></ul></ul><ul><ul><li>return <namelist> </li></ul></ul><ul><ul><li> {$d/employee/name} </li></ul></ul><ul><ul><li></namelist> </li></ul></ul>Результат не обязательно XML ! <ul><ul><li>for $d in xmlcolumn(‘deptdoc’)/dept </li></ul></ul><ul><ul><li>where $d/@bldg = 101 </li></ul></ul><ul><ul><li>return $d/employee/name/ text() </li></ul></ul><ul><ul><li>for $d in xmlcolumn(‘deptdoc’)/dept </li></ul></ul><ul><ul><li>where $d/@bldg = 101 </li></ul></ul><ul><ul><li>return $d/employee/name </li></ul></ul><ul><li><dept bldg=“ 101 ”> </li></ul><ul><li><employee id=“ 901 ”> </li></ul><ul><li><name> John Doe </name> </li></ul><ul><ul><ul><li><phone> 408 555 1212 </phone> </li></ul></ul></ul><ul><ul><ul><li><office> 344 </office> </li></ul></ul></ul><ul><ul><li></employee> </li></ul></ul><ul><ul><li><employee id=“ 902 ”> </li></ul></ul><ul><ul><ul><li><name> Peter Pan </name> </li></ul></ul></ul><ul><ul><ul><li><phone> 408 555 9918 </phone> </li></ul></ul></ul><ul><ul><ul><li><office> 216 </office> </li></ul></ul></ul><ul><ul><li></employee> </li></ul></ul><ul><li></dept> </li></ul>create table dept (deptID char(8), deptdoc xml );
    24. 24. XQuery с объединением for $book in db2-fn:xmlcolumn('BOOKS')/book for $entry in db2-fn:xmlcolumn('REVIEWS')/entry where $book/title = $entry/title return <review> {$entry/review/text()} </review>;
    25. 25. SQL/XML – Лучшее от общих от обоих миров <ul><li>Все возможности SQL для обработки реляционных столбцов </li></ul><ul><li>Все возможности XQuery и XPath 2.0 для адресации и трансформации XML документов </li></ul><ul><li>Объединение XML документов и таблиц </li></ul><ul><li>Предикаты как SQL так и XML </li></ul><ul><li>Создание XML из структурированных полей </li></ul><ul><li>Материализация таблиц и представлений из XML документов </li></ul><ul><li>select d.deptID , u.headcount, xmlquery(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“) </li></ul><ul><ul><li>from dept d, unit u </li></ul></ul><ul><ul><li>where d.deptID = u.unitID and u.headcount > 200 </li></ul></ul><ul><ul><li>and xmlquery(‘$deptdoc/dept/@bldg’ passing d.deptdoc as “deptdoc“) = u.bldg </li></ul></ul><ul><ul><li>and xmlexists(‘$deptdoc/dept/employee/name’ passing d.deptdoc as “deptdoc“) </li></ul></ul>
    26. 26. SQL/XML <ul><li>select d.deptID, xmlquery(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“), u.empcount </li></ul><ul><ul><li>from dept d, unit u </li></ul></ul><ul><ul><li>where d.unitID = u.unitID and u.empcount > 200 </li></ul></ul><ul><ul><li>and xmlquery(‘$deptdoc/dept/@bldg’ passing d.deptdoc as “deptdoc“) = u.bldg </li></ul></ul><ul><ul><li>and xmlexists(‘$deptdoc/dept/name’ passing d.deptdoc as “deptdoc“) </li></ul></ul>Dept Unit <dept bldg=&quot;G&quot;> <name>Engineering</name> <manager>Anjul</manager> <backup>Susan</backup> <admin>Mary</admin> <chargecode>CW345</chargecode> </dept> 30 310 20 240 20 220 10 110 10 100 deptdoc unitID deptID H 32 30 H 123 20 G 234 10 bldg Empcount unitID
    27. 27. SQL/XML – публикация XML документов SELECT XMLELEMENT (NAME &quot;Department&quot;, XMLATTRIBUTES (e.department AS &quot;name&quot; ), XMLAGG ( XMLELEMENT (NAME &quot;emp&quot;, e.firstname))) AS &quot;department_list&quot; FROM employee e GROUP BY e.department; A00 LEE SEAN B01 JOHNSON MICHAEL A00 BARELLI VINCENZO DEPARTMENT LASTNAME FIRSTNAME department_list <Department name=&quot;A00&quot;> <emp>VINCENZO </emp> <emp>SEAN</emp> </Department> <Department name=&quot;B01&quot;> <emp>MICHAEL</emp> </Department>
    28. 28. XMLTABLE - XML->relational SELECT X.* from XMLTABLE (‘ db2-fn:xmlcolumn(“PORDERS.PO”) //customer’ COLUMNS “CID” INTEGER PATH ‘@id’, “Name” VARCHAR(30) PATH ‘name’, “ZipType” CHAR(2) PATH ‘zip/@type’, “Zip” XML PATH ‘zip’ ) AS “X” <zip>95023<zip> US null 4711 <zip>33129<zip> US Bobby 1325 Zip ZipType Name CID
    29. 29. Функции публикации SQL/XML <ul><li>Скалярные функции </li></ul><ul><ul><li>XMLELEMENT – generate XML element </li></ul></ul><ul><ul><li>XMLATTRIBUTES - used within XMLELEMENT, specifies attributes </li></ul></ul><ul><ul><li>XMLFOREST - produces a forest of XML elements from SQL values </li></ul></ul><ul><ul><li>XMLCONCAT - concatenates a variable number of XML values </li></ul></ul><ul><ul><li>XMLNAMESPACES – produces a namespace declarations </li></ul></ul><ul><li>Функции агрегации </li></ul><ul><ul><li>XMLAGG - to group or aggregate XML data </li></ul></ul><ul><li>Табличные </li></ul><ul><ul><li>XMLTABLE – materializes a table from XML documents </li></ul></ul><ul><li>Функции преобразования типов </li></ul><ul><ul><li>XMLCAST - converts between XML data type and standard relational types </li></ul></ul><ul><ul><li>XMLSERIALIZE – converts XML data type to serialized XML as a char/varchar/clob/blob </li></ul></ul>
    30. 30. JDBC API Enhancements for XML <ul><li>Поддержка нового XML типа </li></ul><ul><li>Поддержка нового интерфейса com.ibm.db2.jcc.DB2Xml </li></ul><ul><li>Поддержка XQuery </li></ul><ul><li>Поддержка регистрации XML Schema </li></ul><ul><ul><li>Type Code java.sql.Types.OTHER до тех пор пока не появится новый тип JDBC java.sql.Types.XML </li></ul></ul>
    31. 31. Sample Java Program <ul><li>PreparedStatement stmt1 = con.prepareStatement(&quot;Select doc from dept where id = ‘001’ ”); </li></ul><ul><li>ResultSet rs = stmt1.executeQuery(); </li></ul><ul><li>rs.next(); </li></ul><ul><li>String xmlString = rs.getString(1); </li></ul><ul><li>InputStream is = rs.getBinaryStream(1); </li></ul><ul><li>com.ibm.db2.jcc.DB2Xml xml = (com.ibm.db2.jcc.DB2Xml) rs.getObject (1); </li></ul><ul><li>String xmlString = xmlOut.getDB2String(); </li></ul><ul><li>InputStream is = xmlOut. getDB2XmlBinaryStream(&quot;ISO-10646-UCS-2”); </li></ul><ul><li> … = xmlOut.getDOM() or xmlOut.getSAX(); //future </li></ul><ul><li>PreparedStatement stmt2 = con.prepareStatement(&quot;update dept set doc = ? where id = ‘001”); </li></ul><ul><li>stmt2.setObject(1, xmlOut); </li></ul><ul><li>stmt2.setBinaryStream (1, new FileInputStream(file), (int)file.length()); </li></ul><ul><li>stmt2.setString (1, xmlString); </li></ul><ul><li>stmt2.executeUpdate(); </li></ul>create table dept (id char(8), doc xml);
    32. 32. Sample Java Program – XQuery <ul><li>PreparedStatement stmt=null; </li></ul><ul><li>ResultSet rs; </li></ul><ul><li>String sqls = &quot;XQUERY &quot;+ </li></ul><ul><li>&quot;for $info in db2-fn:sqlquery('SELECT info FROM CUSTOMER WHERE cid > ?') &quot;+ </li></ul><ul><li>&quot;where $info/*:customerinfo/*:addr[@country=&quot;England&quot;] &quot;+ </li></ul><ul><li>&quot;return $info/*:customerinfo/*:phone/text()&quot;; </li></ul><ul><li>stmt = conn.prepareStatement(sqls); </li></ul><ul><li>stmt.setInt(1, cidToFilter); </li></ul><ul><li>rs = stmt.executeQuery(); </li></ul>create table customer (customerinfo xml );
    33. 33. DB2.NET XML Support <ul><li>DB2 .NET Provider </li></ul><ul><li>DB2Xml - Инкапсулирует тип XML </li></ul><ul><ul><li>Любой доступ к XML типу осуществляется через другие объекты основанные на XML (XmlReader, XPathDocument) </li></ul></ul><ul><ul><li>Методы доступа к XML столбцам </li></ul></ul><ul><ul><ul><li>DB2Xml.GetXmlReader </li></ul></ul></ul><ul><ul><ul><li>DB2Xml.GetString </li></ul></ul></ul><ul><ul><ul><li>DB2Xml.GetBytes </li></ul></ul></ul><ul><li>DB2DataReader </li></ul><ul><li>DB2Command </li></ul><ul><li>XML Input и Output Parameters </li></ul><ul><ul><li>DB2Type.Xml </li></ul></ul><ul><li>Поддержка XQuery </li></ul><ul><ul><li>DB2XmlCommand </li></ul></ul><ul><ul><li>DB2XmlAdapter </li></ul></ul><ul><li>Поддержка XmlSchema </li></ul>.NET
    34. 34. Sample .NET Program - XQuery <ul><li>DB2XmlCommand xcmd = new DB2XmlCommand(); </li></ul><ul><li>//Retrieve the name of all employees in department #100 </li></ul><ul><li>xcmd.CommandText = </li></ul><ul><li>“ for $e in db2-fn:xmlcolumn (‘EMPLOYEE.EMPINFO)/employee </li></ul><ul><li>where $e/deptno = 100 </li></ul><ul><li>return {$b/name}” </li></ul><ul><li>//Set the root tag </li></ul><ul><li>xcmd.RootTag = “deptlist”; </li></ul><ul><li>//Retrieve the result of the xquery expression as an XmlReader </li></ul><ul><li>//the result will be wrapped with <deptlist> </deptlist> </li></ul><ul><li>XmlReader xrdr = xcmd.ExecuteXmlReader(); </li></ul><ul><li>//Retrieve the result of the xquery expression as a Stream </li></ul><ul><li>Stream xmlstream = xcmd.ExecuteStream() </li></ul>create table employee ( empinfo XML ) )
    35. 35. Проверка с помощью XML Schemas <ul><li>Проверка опциональна и осуществляется на уровне документа </li></ul><ul><ul><li>Без проверки </li></ul></ul><ul><ul><ul><li>insert into dept(deptdoc) values (?) </li></ul></ul></ul><ul><ul><li>С проверкой </li></ul></ul><ul><ul><ul><li>insert into dept(deptdoc) values (xmlvalidate(?)) </li></ul></ul></ul><ul><li>Схема может быть перезаписана и указывать на схему в репозитории DB2 </li></ul><ul><ul><li>insert into dept(deptdoc) values ( </li></ul></ul><ul><li>xmlvalidate(? according to xmlschema id “ibm.invoice”) </li></ul><ul><ul><li>insert into dept(deptdoc) values ( </li></ul></ul><ul><li>xmlvalidate(? according to xmlschema uri ‘http://my.world.com’ ) </li></ul>
    36. 36. Управление XML Schema <ul><li>Репозиторий XML Schema (XSR) </li></ul><ul><ul><li>Хранит зарегистрированные схемы </li></ul></ul><ul><ul><li>Управляется как часть каталога DB2 </li></ul></ul><ul><ul><li>Таблицы и представления создаются автоматически </li></ul></ul><ul><ul><ul><li>SYSCAT.XSROBJECTS, SYSCAT.XSROBJECTCOMPONENTS </li></ul></ul></ul><ul><ul><ul><li>SYSCAT.XSROBJECTAUTH, SYSCAT.XSROBJECTHIERARCHIES </li></ul></ul></ul><ul><ul><li>Интерфейс командной строки, API, Хранимые процедуры </li></ul></ul>XSR_COMPLETE( rschema , name , schemaproperties , isusedforshred ) Complete XSR_ADDSCHEMADOC( rschema, name , schemalocation , content , docproperty ) Add XSR_REGISTER( rschema , name , schemalocation , content , docproperty ) Регистрация Хранимые процедуры
    37. 37. Аннотация схемы для Нарезки <ul><li>Отображение из XML в реляционные таблицы </li></ul><ul><ul><li>Отображение контролируется аннотациями XML в DB2 XSR </li></ul></ul>The default schema for the table names db2-xdb: defaultSQLSchema Referential constraints db2-xdb : dependence Multiple mappings, to same or different tables, for an element/attribute db2-xdb : tableMapping Conditions to apply to rows before insert db2-xdb : condition Custom expressions to apply to the data before insert db2-xdb : expression White space treatment db2-xdb : normalization Truncate content if the size is greater than the specified size in the database db2-xdb : truncate Text value, string value or xml fragment to be treated as the content to be inserted into the database db2-xdb : contentHandling The column name of the table the item should be mapped to db2-xdb : column The table name the element/attribute should be mapped to db2-xdb : rowSet Цель Аннотация
    38. 38. <attribute name=&quot;orderID&quot; type=“xs:string“ db2-xdb:rowSet = “ PURCHASE_ORDER ” db2-xdb:column = “ ORDERID ” > <annotation> <appinfo> < db2-xdb:tableMapping > < db2-xdb:rowSet > ELECTRONICITEMS </ db2-xdb:rowSet > < db2-xdb:column > ORDERID </ db2-xdb:column > </ db2-xdb:tableMapping > </appinfo> </annotation> </attribute> … <sequence> <element name=&quot;productName“ type=&quot;string“/> <element name=&quot;quantity“ type=“ipo:derivedPositiveIntegerType” db2-xdb:rowSet =“ ELECTRONICITEMS ” db2-xdb:column =“ QTY ”/> …… .<!– ignoring mapping of PRICE --> …. <attribute name=&quot;partNum&quot; type=&quot;ipo:SKU“ db2-xdb:rowSet =” ELECTRONICITEMS ” db2-xdb:column =“ PARTNUM ” db2-xdb:expr =“ udf_convertToInternalPart ( $SELF )” db2-xdb:cond =“ udf_isElectronicItem ( $SELF ) = ‘ true’/>…….. ELECTRONICITEMS <ipo:purchaseOrder ….. orderDate=&quot;1999-12-01“ orderID=“19991201-AZFG”> ……….. <item partNum=&quot; 833-AA &quot;> <productName>Phone </productName> <quantity>1</quantity> <USPrice>132.95 < /USPrice> <shipDate>1999-12-05</shipDate> </item> <item partNum=“533-AC&quot;> <productName>Cycle</productName> <quantity>1</quantity> <USPrice>149.95 < /USPrice> <shipDate>1999-12-05</shipDate> </item></items></ipo:purchaseOrder> 132.95 PRICE 1 QTY 833-AA PARTNUM 19991201-AZFG ORDERID
    39. 39. DB2 Development Workbench <ul><li>Eclipse based </li></ul><ul><li>Support for XML type in tables, views, SPs and UDFs </li></ul><ul><li>Support for XML Index </li></ul><ul><li>Support for XML type in SQL Query Builder </li></ul><ul><li>Graphical XML Query Builder </li></ul><ul><li>XSD (XML Schema) Editor </li></ul><ul><li>XML Editor </li></ul><ul><li>XML viewer </li></ul><ul><li>Support for XML Schema registration </li></ul><ul><li>XML & XSL Parsers </li></ul><ul><li>XML<->Relational mapping </li></ul>Server Explorer Project Explorer Properties & Output Area Visualization & Editors
    40. 40. XQuery Builder Java <ul><li>Graphical XQuery builder </li></ul><ul><li>Supports selecting from actual documents to build query </li></ul><ul><li>Can view in progress XQuery statement </li></ul><ul><li>Save Statements for re-use </li></ul><ul><li>Execute and view results </li></ul>
    41. 41. MS Visual Studio .NET – DB2 XML add-in .NET <ul><li>Server Explorer </li></ul><ul><li>XML Editor </li></ul><ul><li>XML Schema Editor </li></ul><ul><li>XSR Registration </li></ul><ul><li>XML Index Builder </li></ul>
    42. 42. DB2 Viper в Storebrand <ul><li>Лидирующий игрок , на рынке страхования здоровья и жизни , управления активами и ценными бумагами в Норвегии . </li></ul><ul><li>Пионеры в адаптации SOA, Web Services и XML в информационных системах </li></ul><ul><li>Senior Enterprise Architect Thore Thomassen тесно работал IBM на протяжении Viper Alpha </li></ul><ul><li>Преимущество Native XML в сравнительных тестах </li></ul><ul><ul><li>Сокращение времени разработки внутренних отчетов с более чем 1 day до 10 минут </li></ul></ul><ul><ul><li>Сокращение составляющей I/O для Web services в среднем на an 65% и сокращение времени поддержки на 20% </li></ul></ul><ul><ul><li>Реализация изменения схемы до нескольких минут с целого дня прототипирования и тестирования и целой недели внедрения </li></ul></ul><ul><ul><li>Реализация поиска и извлечения документов в соответствии с новыми требованиями в 30 минут , ранее требовалось 2 часа with decomposition and 8 hours with CLOB. </li></ul></ul>
    43. 43. Partner Solutions JustSystem
    44. 44. Немного о других новых возможностях <ul><li>STTM – самонастраиваемая и конфигурируемая память DBMS </li></ul><ul><li>LBAC – Ограничение доступа на уровне строк </li></ul><ul><li>Hybrid Partitioning </li></ul><ul><li>Компрессия данных </li></ul><ul><li>Улучшения в Резервном копировании etc… </li></ul>
    45. 45. Автоматизация автоматически ! <ul><li>Включение множества автономных возможностей по умолчанию . </li></ul><ul><li>Примеры : </li></ul><ul><ul><li>Configuration Advisor (2 second tuning) </li></ul></ul><ul><ul><li>Adaptive Self Tuning Memory </li></ul></ul><ul><ul><li>Автоматический сбор статистики . </li></ul></ul><ul><li>Автоматическое вычисление параметров I/O </li></ul><ul><ul><li>Значения вычисляются во время запуска </li></ul></ul><ul><ul><ul><li>Основываются на кол-ве CPU расположении дисков </li></ul></ul></ul>
    46. 46. STMM в действии – Удаление важного индекса TPCH Query 21 - After drop index - Average times for the 10 streams 0 1000 2000 3000 4000 5000 6000 7000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Order of execution Time in seconds Avg = 959 Avg = 2285 Avg = 6205 Reduced 63% Indexes Dropped
    47. 47. Security - Label Based Access Control <ul><li>Label Based Access Control (LBAC) </li></ul><ul><ul><li>“ label” ассоциирован как с пользовательской сессией так и со строками </li></ul></ul><ul><ul><li>Правила ( Rules ) проверяют метки пользователей и строк для выявления прав </li></ul></ul><ul><li>Labels могут состоять из множества компонентов </li></ul><ul><ul><li>Иерархия , группа и массив </li></ul></ul><ul><ul><li>Метка на строку есть дополнительный вне зависимости от количества компонентов метки </li></ul></ul><ul><ul><li>Пользовательские метки выдаются security administrator </li></ul></ul><ul><li>Похожа на поддержку LBAC в DB2 для z/OS v8 </li></ul>
    48. 48. LBAC Hierarchy Update/Read A 255 B 250 C 254 D 253 B1 100 B2 100 B1-1 50 B1-2 50 B2-3 50 A1 254 A 255 B 250 C 254 D 200 B1 100 B2 100 B1-1 50 B1-2 50 B2-3 50
    49. 49. Hybrid Partitioning 999 Machines HASH RANGE 32K Partitions MDC 64G A-C 64G D-M 64G N-Q 64G R-Z
    50. 50. Region Year East 97 North South West 98 99 00 0th Block BID = 0-0 Pg 0 Pg 1 Pg 2 Pg 3 Pg 20 Pg 21 5th Block BID = 20-0 01 Pg 22 Pg 23 Block INDEX ANDing CREATE TABLE SALES (Customer VARCHAR(80), Region CHAR(5), Year INT) ORGANIZE BY DIMENSIONS (Region, Year) SELECT * FROM SALES WHERE Region = 'West' AND Year = 00 <ul><li>'West' BIDs: 16-0, 20-0 </li></ul><ul><li>'00 BIDs: 16-0 </li></ul><ul><li>Result of AND: 16-0 </li></ul><ul><li>Retrieve block 16-0 in one I/O </li></ul><ul><li>Mini-relation scan retrieves all records in block </li></ul>CREATE INDEX i1 ON SALES (Customer) SELECT * FROM SALES WHERE Region='East' AND Customer='Joe' <ul><li>'East' BIDs: 0-0, 4-0 </li></ul><ul><li>'Joe' RIDs: 0-3, 0-211, 2-97, 7-1, 11-33 </li></ul><ul><li>Filter out RIDs not in page range indicated by BIDs 0-3, 0-211, 2-97, 7-1 </li></ul><ul><li>Directly fetch those records </li></ul>&quot;AND&quot;ing RID and Block INDEXes Примеры обработки запросов MDC изнутри
    51. 51. Row Compression используется LZV John, Dept 500, 20000, Plano, TX, 24355 Компрессия множества строк в одну страницу не эффективно с точки зрения БД . Fred, Dept 500, 10000, Plano, TX, 24355, … Fred, Dept 500, 10000, Plano, TX, 24355, …John, Dept 500, 20000, Plano, TX, 24355
    52. 52. Row Compression Using Side Tables John, Dept 500, 20000, Plano, TX, 24355, Site 3 Сторонние таблицы содержат повторяющуюся информацию из строк . Fred, Dept 500, 10000, Plano, TX, 24355… Fred, (01), 10000, (02), John, (01), 20000, (02) … … Plano, TX, 24355 02 Dept 500 01
    53. 53. DB2 - More Compression Ratios (Customer Data) Compression Type 32KB Page Count Space Required on Disk No compression 5893888 179.9GB Row compression 1392446 42.5GB % Pages Saved: 76.4%
    54. 54. Informix Dynamic Server 10
    55. 55. IBM Informix Dynamic Server Roadmap <ul><li>2008 </li></ul><ul><li>Запросы рынка , Technology & заказчиков партнеров </li></ul><ul><li>Интеграция с IBM Software </li></ul><ul><li>Улучшения Автономности </li></ul><ul><li>MDC </li></ul><ul><li>MQT </li></ul><ul><li>Март 2003 </li></ul><ul><li>Производительность </li></ul><ul><li>Backup & Restore </li></ul><ul><li>HDR & ER сосуществование </li></ul><ul><li>Удаление ограничений на размеры . </li></ul><ul><li>Мониторинг , Утилиты </li></ul>2004 2005 2006 2007 2008 2003 IDS v 10.5 IDS v9.40 IDS v 10 IDS vNext <ul><li>2H 2006 </li></ul><ul><li>Запросы рынка , Technology & заказчиков партнеров </li></ul><ul><li>Интеграция с IBM Software </li></ul><ul><li>Автономность (Online Table Reorg , GUI , SQL) </li></ul><ul><li>Q1 2005 </li></ul><ul><li>Безопасность </li></ul><ul><li>Устойчивость / Высокая доступность </li></ul><ul><li>Разработка Соответствие стандартам </li></ul><ul><li>Автономность / Простота администрирования </li></ul><ul><li>Интеграция с IBM SWG </li></ul><ul><li>Запросы клиентов и партнеров </li></ul>
    56. 56. Increase in Nightly Builds and Tests (IDS(4), CSDK, GLS, 4GL) 57000 4000 74 4
    57. 57. IDS Уменьшение кол-ва ошибок 2001 2002 2003 2004 IDS 9.21 IDS 9.30 Defect Backlog 9.30.UC7 – 250 fixes 7.31.UD7 7.31.UD6 9.40.UC3 IDS 9.40 IDS 7.31
    58. 58. IBM Software Portfolio – использование компонентов Общие возможности Общие комопоненты Инвестиции В продукты Начальные продукты Re-factor to SWG Product Offerings Componentization and Formation of Substrates Product Specific Investment Product Specific Investment Product Specific Investment Product Specific Investment Product Specific Investment Lotus DB2/Informix WebSphere Tivoli Rational Lotus Tivoli Rational Tivoli Rational WebSphere DB2/Informix Lotus WebSphere components DB2/Informix Lotus WebSphere Tivoli DB2/Informix
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×