Oracle XSQL Page Processor and Servlet
XSQL Servlet is a tool that processes SQL queries and outputs the result set as XML. This processor is implemented as a Java servlet and takes as its input an XML file containing embedded SQL queries. It uses XML Parser for Java, XML- SQL Utility, and Oracle XSL Transformation (XSLT) Engine to perform many of its operations.
You can use XSQL Servlet to perform the following tasks:
- Build dynamic XML "datapages" from the results of one or more SQL queries and serve the results over the Web as XML datagrams or HTML pages using server-side XSLT transformations.
- Receive XML posted to your web server and insert it into your database.
Servlet Engines that Support XSQL Servlet
XSQL Servlet has been tested with the following servlet engines:
- Allaire JRun 2.3.3
- Apache 1.3.9 with JServ
1.0 and 1.1
- Apache 1.3.9 with Tomcat
3.1 Beta1 Servlet Engine
- Apache Tomcat 3.1 Beta1
Web Server + Servlet Engine
- Caucho Resin 1.1
- NewAtlanta ServletExec 2.2
for IIS/PWS 4.0
- Oracle8i Lite Web-to-Go
Server
- Oracle Application Server
4.0.8.1 (with "JSP Patch")
- Oracle8i 8.1.7 Beta "Aurora"
Servlet Engine
- Sun JavaServer Web Development
Kit (JSWDK) 1.0.1 Web Server
JavaServer Pages (JSP) Platforms that Support XSQL Servlet
JavaServer Pages can use <jsp:forward> and/or <jsp:include> to collaborate with XSQL Pages as part of an application. The following JSP platforms have been tested to support XSQL Servlet:
- Apache 1.3.9 with Tomcat 3.1 Beta1 Servlet Engine
- Apache Tomcat 3.1 Beta1 Web Server + Tomcat 3.1 Beta1 Servlet Engine
- Caucho Resin 1.1 (Built-in JSP 1.0 Support)
- NewAtlanta ServletExec 2.2 for IIS/PWS 4.0 (Built-in JSP 1.0 Support)
- Oracle8i Lite Web-to-Go Server with Oracle JSP 1.0
- Oracle8i 8.1.7 Beta "Aurora" Servlet Engine with Oracle JSP 1.0
- Any Servlet Engine with Servlet API 2.1+ and Oracle JSP 1.0
In general, it should work with the following:
- Any servlet engine supporting the Servlet 2.1 Specification or higher
- Oracle JSP 1.0 reference implementation or functional equivalent from another vendor
XSQL Servlet is a tool that processes SQL queries and outputs the result set as XML. This processor is implemented as a Java servlet and takes as its input an XML file containing embedded SQL queries. It uses XML Parser for Java and XML-SQL Utility to perform many of its operations.
Figure 3-4 shows how data flows from a client, to the servlet, and back to the client. The sequence of events is as follows:
- The user enters a URL through a browser, which is interpreted and passed to the XSQL Servlet through a Java Web Server. The URL contains the name of the target XSQL file (.xsql) and optionally, parameters, such as values and an XSL stylesheet name. Alternatively, the user can invoke the XSQL Servlet from the command line, bypassing the browser and Java web server.
- The servlet passes the XSQL file to the XML Parser for Java, which parses the XML and creates an API for accessing the XML contents.
- The page processor component of the servlet uses the API to pass XML parameters and SQL statements (found between <query></query> tags) to XML-SQL Utility. The page processor also passes any XSL processing statements to the XSLT Processor.
- XML-SQL Utility sends the SQL queries to the underlying Oracle8i database, which returns the query results to the utility.
- XML-SQL Utility returns the query results to the XSLT Processor as XML formatted text. Results are embedded in the XML file in the same location as the original <query> tags.
- If desired, the query results and any other XML data are transformed by the XSLT Processor using a specified XSL stylesheet. The data can be transformed to HTML or any other format defined by the stylesheet. The XSLT Processor can selectively apply different stylesheets based on the type of client that made the original URL request. This HTTP_USER_AGENT information is obtained from the client through an HTTP request.
- The XSLT Processor passes the completed document back to the client browser for presentation to the user.
Figure 3-4 Oracle XSQL Page Processor and Servlet Functional Diagram