gaining and keeping competitive advantage through j2ee and xml interoperability dimitri maesfranckx...
TRANSCRIPT
Gaining and keepingcompetitive advantage through J2EE and XML interoperability
Dimitri MaesfranckxProduct Manager
Content
Reality Database vendors Introduction Application Scenario Builder Query Example Features Key Advantages Q&A
Reality
XML versus databases
“The truth of the matter. The RDBMS is not going anywhere anytime soon, if ever.
Even ignoring serious issues such as relational data representation in XML, the
DBMS technology is a core part of too many applications in use today. Although XML may be a realistic possibility for some smaller applications without legacy data or
legacy application dependencies, most large-scale production applications must interface with existing data. This data is almost always maintained in a relational
database.”JAVA and XML (Page 339)
By Brett McLaughlin – O’REILLY®
How Can I Access Data Using XML?
Not an easy answer! JDBC/ODBC/ADO/OLE DB XQL Xquery Xpath HTTP extensions DBMS extensions XML-QL SQL extensions …
DB Standard APIs
ODBC SQLExecDirect (hstmt, “Select * from Inventory”, SQL_NTS) SQLSetStmtAttr (hstmt, SQL_PERSIST_AS_XML, “//myweb/
inventorylist/inventory.xml”, SQL_NTS)
ADO rsXML.Open “Select * from Inventory”, conn rsXML.Save “//myweb/inventorylist/inventory.xml”,
adPersistXML
JDBC … similar using Webrowset interface
DBMS extentions
SQL Server Specify SQL Queries into the URL
http://IISServer/nwind?sql=SELECT+*+FROM+Inventory+FOR+XML+AUTO&root=root
Returns query as XML document Specify SQL Query Templates in the URL
http://IISServer/nwind/QueryFile.xml
DBMS extentions
Oracle XSQL Pages - XML formatted servlet definition that
creates or consumes XML based on the underlying databasehttp://MyServer/InventoryToday.xsql?id=12
Where XSQL defined as:<xsql:query connection=“Inventorydb" xmlns:xsql="urn:oracle-xsql">SELECT * FROM Inventory WHERE ID = '{@id}‘</xsql:query>
DBMS extentions
IBM IBM DB2 UDB (7.1) - XML Extender DAD or Document Access Definition file Flexible query or table.column based mapping Stored procedure programming model (Java,C++,...) Both retrieve and update functionality XML results are ‘dumped’ in a special DB2 table
XQuery
Example:
Return a "flat" list of supplier names and their part descriptions, in alphabetic order.
FOR $sp IN document("sp.xml")//sp_tuple, $p IN document("p.xml")//p_tuple[pno = $sp/pno], $s IN document("s.xml")//s_tuple[sno = $sp/sno] RETURN <sp_pair> $s/sname , $p/descrip </sp_pair>SORTBY (sname, descrip)
jXTransformer Introduction
Defines grammar to retrieve data and transform this into complex XML structures.
jXTransformer API that processes the Query, returns the data in the required XML structure.
jXTransformer Builder GUI tool to help you build and test queries.
Uses a DataDirect JDBC J2EE certified drivers to communicate with the RDBMS.
jXTransformer Querywith JDBC application scenario
JAVA Application with jXTransformer
Query
DataDirectJDBC Driver
RDBMS
jXTranformerAPI
XMLDocument
jXTransformer Builder
Create and modify quickly without having to know the syntax.
Check and test syntax and semantics.
jXTransformer Query Example
SELECT e.EmployeeID, e.FirstName, e.LastName, e.Title, e.HireDate, e.Salary
FROM Employees e WHERE e.HireDate = {d ’2000-01-01’}
SELECTxml_element(’Employees_Info’
xml_attribute(’ID’, e.EmployeeID),xml_element(’name’,
xml_element(’first’,e.FirstName),xml_element(’last’, e.LastName) ),
xml_element(’title’, e.Title),xml_element(’hiredate’,e.HireDate),xml_element(’salary’, e.Salary) )
FROM Employees e WHERE e.HireDate = {d ’2000-01-01’}
jXTransformer Query Example
<?xml version="1.0" encoding="UTF-8" ?><xes-result>
<Employees_Info ID='234567'><name>
<first>Jane</first><last>Smith</last>
</name><title>Director</title><hiredate>2000-01-01</hiredate><salary>120000</salary>
</Employees_Info></xes-result>
jXTransformer Query Example
jXTransformer Features
Any relational DB supported by the DataDirect JDBC drivers.
DOM, JDOM, SAX and reader/writer object interfaces.
DTDs, schemas, namespaces and CDATA. Nested jXTransformer queries. Document-level processing instructions. Parameter markers, SQL92 select list
expressions and JDBC scalar functions.
jXTransformer Key Advantages
Uniform and database independent Fraction of the usual required resources Leverage existing knowledge Portable code, portable data
Q&AjXTransformer allows you to retrieve data from relational databases and transform that
data into complex XML structures .
All that is required is a JDBC connection with a DataDirect JDBC driver.
jXTransformer is flexible and powerful, allowing you to structure the data any way you want it in the resulting XML document and create well-formed and valid XML
documents for data exchange.
The jXTransformer Builder tool makes it easy for you to build and test
jXTransformer queries.