IBM®
Skip to main content
    United States change      Terms of use
 
 
Select a scope:    
     Home      Products      Services & industry solutions      Support & downloads      My account     
alphaWorks  >  Information management  >  

URI Access for DB2

A servlet that uses several access methods to address data and metadata stored in DB2.


Date Posted: September 25, 2003
OverviewRequirements Download FAQs Forum Reviews

What is URI Access for DB2?

URI Access for DB2 is a servlet that uses several access methods to address and retrieve data and metadata stored in DB2. It uses Uniform Resource Identifiers (URIs) provided by clients, thereby enabling easy access to one or more DB2 instances through Web browsers and other clients that use the supported protocols. Currently, URI Access for DB2 supports only HTTP.

Rules govern the structure of URIs for the different access methods. These rules are described in the accompanying white paper (PDF).

Internally, the URIs are transformed into SQL statements. Then the database server executes these SQL statements and sends the results back to the client. Several formatting options exist for the output.

Get Adobe® Reader®

How does it work?

URI Access for DB2 contains the following two main components:
  • A set of stored procedures and user-defined functions (UDFs) on the DB2 server. URI Access for DB2 uses these stored procedures to do the following:
    • Access database content
    • Format the output
    • Maintain metadata.

    To use these functions and stored procedures, every database accesssed through URIs must be enabled. URI Access for DB2 can be used without enabling a database, but then the functionality is limited.

  • A Java servlet running on an application server such as WebSphere, Bobcat, or Tomcat. The Java servlet performs the following actions:
    • Accepts requests from HTTP clients
    • Chooses the appropriate access method (defined by the URI)
    • Calls DB2 via JDBC to retrieve the data
    • Creates the HTTP response message sent to the client.

URI Access for DB2 can be used to access data in DB2 by using the following methods:

  • SQL query access: The SQL query is given as a URI query parameter that is attached after the ? character. The SQL query access method currently supports only SELECT queries.
  • Navigation-based (path) access: A hierarchy of DB2 objects can be addressed by using a path. Currently, only tables and columns can be addressed. Conditions can be applied to select a subset of the table and column data. If a column is addressed that is XML-enabled (via XML extender), XPath can be applied.
  • Application-defined mapping: A relative URI can be defined; it is mapped to a SQL statement. When the URI is requested, the mapped statement is executed and the result is returned to the client.

The following options exist for formatting the result:

  • Native: The native option should be chosen if one wants data to be returned in its "native" format. When the native option is chosen and more than one cell is addressed, only the first cell of the first column is returned.
  • Text: The text option should be chosen if one wants all of the data in the result set to be converted to text and returned to the client. When the text option is chosen, binary data (such as BLOB data or character data defined as FOR BIT DATA) is encoded with the base64 encoding scheme. Other data (such as DATE, TIME, INTEGER, DOUBLE, and so forth) is returned as human-readable text. To improve readability, one can include a column delimiter string and a row delimiter string.
  • Console: The console option should be chosen if one wants all of the data in the result set to be displayed as in the DB2 command shell. The data will be shown in a tabular form with column names.
  • SQL/XML: The sqlxml option should be chosen if one wants to create an XML document from the result set. The notations that are described in the SQML/XML standard dictate the XML tagging that is used.

Metadata can be retrieved for every result set. Metadata is returned as an XML schema document. The notations that are described in the SQL/XML standard are used to map between database types and XML types.

URI Access for DB2 offers the following additional features:

  • MIME type detection: URI Access for DB2 automatically detects the MIME type of the content by looking on the first few bytes of the data. The MIME type helps the client to determine how to handle the data. For example, a Web browser will display an image only if the HTTP message contains the accurate MIME type.
  • Authentication and authorization: URI Access for DB2 supports two authentication methods:
    • If the client is a database user, it can authenticate itself directly against the database.
    • The authentication and authorization methods of the application server can be used to challenge the client against a third-party registry.
  • Content compression: To reduce the number of bytes sent over the network, URI Access for DB2 can compress the data before sending it to the client.
  • XPath query: If the database is enabled for the DB2 XML Extender, you can access XML-enabled columns through XPath.

About the technology author(s):
Michael Schenker is currently a graduate student from the University of Applied Sciences in Leipzig, Germany. He works as a supplemental for the DB2 Information Integration department at IBM's Silicon Valley Laboratory in San Jose, California. Mr. Schenker can be reached at mschenk@us.ibm.com.

Susan Malaika has been an IBM Academy of Technology member since 1995. She co-edited a book on the Web in 1996. Ms. Malaika has worked in DB2 since 1998; she specializes in XML and Web technologies, including grid computing. She can be reached at malaika@us.ibm.com.

Amit Somani is a manager in the DB2 Information Integration Development team. He leads the areas of Web Services and Application and Data Integration. Before this, Mr. Somani spent over six years at IBM Research and made significant contributions in the areas of data-driven e-commerce applications, log-based recovery technology for Lotus Notes, SMP-Query Parallelism for DB2 UDB, and TPC-C/TPC-D Benchmarking for IBM DB2/NT/PCServer. He holds several patents and is the recipient of three IBM Outstanding Technical Achievement awards. Mr. Somani holds a B. Tech in Computer Science and Engineering from IT-BHU, India, and an M.S. in Computer Science from the University Of Wisconsin at Madison. He can be reached at somani@almaden.ibm.com.

Download now Download now

Related technologies

For platform(s):
AIX, Windows NT, Linux

For topics:
relational, retrieval, SQL


Related resources

DB2 Developer Domain

IBM Developer Solutions

Press Articles

 

    About IBM Privacy Contact