Title: Gaining and keeping competitive advantage through J2EE and XML interoperability
1Gaining and keepingcompetitive advantage through
J2EE and XML interoperability
- Dimitri Maesfranckx
- Product Manager
2Content
- Reality
- Database vendors
- Introduction
- Application Scenario
- Builder
- Query Example
- Features
- Key Advantages
- QA
3Reality
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 OREILLY
4How 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
5DB 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
6DBMS extentions
- SQL Server
- Specify SQL Queries into the URLhttp//IISServer/
nwind?sqlSELECTFROMInventoryFORXMLAUTOroo
troot - Returns query as XML document
- Specify SQL Query Templates in the
URLhttp//IISServer/nwind/QueryFile.xml
7DBMS extentions
- Oracle
- XSQL Pages - XML formatted servlet definition
that creates or consumes XML based on the
underlying databasehttp//MyServer/InventoryToday
.xsql?id12 - Where XSQL defined asltxsqlquery
connectionInventorydb" xmlnsxsql"urnoracle-xs
ql"gtSELECT FROM Inventory WHERE ID
'_at_idlt/xsqlquerygt
8DBMS 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
9XQuery
- 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_tuplepno sp/pno, s IN
document("s.xml")//s_tuplesno sp/sno RETURN
ltsp_pairgt s/sname , p/descrip
lt/sp_pairgtSORTBY (sname, descrip)
10jXTransformer 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.
11jXTransformer Querywith JDBC application scenario
JAVA Application with jXTransformer Query
jXTranformerAPI
XMLDocument
DataDirectJDBC Driver
RDBMS
12jXTransformer Builder
- Create and modify quickly without having to know
the syntax. - Check and test syntax and semantics.
13jXTransformer 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
14jXTransformer Query Example
SELECTxml_element(Employees_Info xml_attribute
(ID, e.EmployeeID), xml_element(name, xml_e
lement(first,e.FirstName), xml_element(last,
e.LastName) ), xml_element(title,
e.Title), xml_element(hiredate,e.HireDate), xm
l_element(salary, e.Salary) )FROM Employees e
WHERE e.HireDate d 2000-01-01
15jXTransformer Query Example
lt?xml version"1.0" encoding"UTF-8"
?gtltxes-resultgt ltEmployees_Info
ID'234567'gt ltnamegt ltfirstgtJanelt/firstgt ltl
astgtSmithlt/lastgt lt/namegt lttitlegtDirectorlt/titl
egt lthiredategt2000-01-01lt/hiredategt ltsalarygt120
000lt/salarygt lt/Employees_Infogtlt/xes-resultgt
16jXTransformer 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.
17jXTransformer Key Advantages
- Uniform and database independent
- Fraction of the usual required resources
- Leverage existing knowledge
- Portable code, portable data
18QA
jXTransformer 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.
Dimitri.Maesfranckx_at_MERANT.COM