Retrieving lots of rows through XSQL servlet

Hi Steve!
I am currently trying to break XSQL-servlet in order to have some proof of usability for our customers.
During one of these 'sessions' I discovered that the XSQL servlet throws me out with an exception error (out of memory) when I try to retrieve 70K+ rows from a table using the XSQL commandline utility. The same thing happens when requested through the webserver.
This is definitely something I would like to be able to do without problems and (preferably) without too much programming.
Do you know of an elegant way to handle this?
BTW: We are trying to write a plain-and-simple export-to-XML utility, which dumps all rows of a given table to an XML file which we can feed to the XMLLoader utility from your book (which is -by the way- a great book!!)
Would you be able to give us some suggestions?

Here's some working code:
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.util.Stack;
import java.io.*;
public class ExampleContentHandler extends DefaultHandler {
PrintWriter p;
Stack s;
ExampleContentHandler(PrintWriter p) {
this.p = p;
public void startDocument() {
s = new Stack();
public void startElement(String uri,
String localName,
String qname,
Attributes attrs) throws SAXException {
s.push(qname);
p.print("<"+qname);
int numAttrs = attrs.getLength();
for (int j = 0; j < numAttrs; j++) {
p.print((new StringBuffer(" ")).append(attrs.getQName(j))
.append("='")
.append(attrs.getValue(j))
.append("'").toString());
p.print(">");
public void endElement(String uri,
String localName,
String qname) throws SAXException {
s.pop();
p.print("</"+qname+">");
public void characters(char[] p0, int p1, int p2) throws SAXException {
p.print(quote(new String(p0,p1, p2)));
public void endDocument() {
p.flush();
private String quote(String val)
StringBuffer s = new StringBuffer();
int len = val.length();
for (int i = 0; i < len; i++ )
char c = val.charAt(i);
switch (c)
case '\r':
s.append('\n');
break;
case '&':
s.append("&;");
break;
case '<':
s.append("<");
break;
case '>':
s.append(">");
break;
default:
s.append(c);
return s.toString();
import org.xml.sax.*;
import java.sql.*;
import java.io.*;
import oracle.xml.sql.query.*;
import oracle.xml.parser.v2.*;
class XMLForQueryResults {
public static void main (String arg[]) throws Exception {
Connection cn = ConnectionHelper.getConnection();
OracleXMLQuery q = new OracleXMLQuery(cn,
"SELECT empno as EmpNo, " +
" ename as Name, " +
" sal as Salary" +
" FROM emp WHERE empno = 7839");
String s = q.getXMLString();
StringReader sr = new StringReader(s);
SAXParser sp = new SAXParser();
PrintWriter p = new PrintWriter(System.out);
ContentHandler c = new ExampleContentHandler(p);
sp.setContentHandler(c);
sp.parse(sr);
q = new OracleXMLQuery(cn,
"SELECT empno as \"@EmpNo\", " +
" ename as Name, " +
" sal as Salary" +
" FROM emp WHERE empno = 7839");
p = new PrintWriter(System.out);
c = new ExampleContentHandler(p);
q.getXMLSAX(c);
cn.close();
}

Similar Messages

  • Posting XML to XSQL servlet

    Hi
    I use Java to post an XMLDocument to the XSQL servlet
    my java program :
    public void envoie() throws java.lang.Exception {
    try{
    Hashtable params = new Hashtable(1);
    URL pageUrl = new URL("http://k2sun2/xsql/insert_crpersonnes_cr.xsql");
    // Construct a new XSQL Page request
    XSQLRequest req = new XSQLRequest(pageUrl);
    org.w3c.dom.Document converted= (org.w3c.dom.Document)xmldoc;
    req.setPostedDocument(converted);
    req.process(params, new PrintWriter(System.out), new PrintWriter(System.err));
    }catch(Exception e){
    System.out.println(e);
    the program returns this error :
    <?xml version = '1.0'?><xsql-status action="xsql:insert-request" result="No posted document to process"/>
    null

    The http get is a "red herring". I wanted to see what was being fired at the xsql page and I thing the "get" referred to the retrieval of the xsql page. Anyway, here's exactly what I've got:
    Receiving Table:
    create table newsstory
    (id number
    ,title varchar2(2000)
    ,url varchar2(2000)
    ,source varchar2(2000)
    XSQL Page:
    <?xml version="1.0"?>
    <testpage connection="demo" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-param name="param1"/>
    <xsql:include-param name="param2"/>
    <xsql:insert-request table="newsstory"/>
    </testpage>
    Java Program:
    import oracle.xml.xsql.XSQLRequest;
    import java.util.Hashtable;
    import java.io.*;
    import org.w3c.dom.*;
    import oracle.xml.parser.v2.*;
    import java.net.URL;
    import com.db.atg.util.XMLUtil;
    import org.apache.xerces.parsers.DOMParser;
    public class XSQLRequestSample {
    public static void main( String[] args) throws Exception {
    // Construct the URL of the XSQL Page
    URL pageUrl = new URL("http://cbitwebd1.dev.lon.deuba.com:9091/tramp_dev/jmw1.xsql");
    // Construct a new XSQL Page request
    XSQLRequest req = new XSQLRequest(pageUrl);
    // Setup a Hashtable of named parameters to pass to the request
    Hashtable params = new Hashtable(3);
    params.put("param1","value1");
    params.put("param2","value2");
    // Prepare an XML Document to post
    String xmldocstring = "<ROWSET><ROW><ID>55</ID><TITLE>Test Title</TITLE><URL>Test URL</URL><SOURCE>Test Source</SOURCE></ROW></ROWSET>";
    oracle.xml.parser.v2.DOMParser d = new oracle.xml.parser.v2.DOMParser();
    d.parse(new StringReader(xmldocstring));
    Document doc2Post = d.getDocument();
    // Print out the contents of do2Post to check there is something to post.
    System.out.println("value is " + XMLUtil.dom2XmlString(doc2Post));
    req.setPostedDocument(doc2Post);
    // Process the page, passing the parameters and writing the output
    // to standard out.
    req.process(params,new PrintWriter(System.out)
    ,new PrintWriter(System.err));
    Output:
    value is <ROWSET><ROW><ID>55</ID><TITLE>Test Title</TITLE><URL>Test
    URL</URL><SOURCE>Test Source</SOURCE></ROW></ROWSET>
    <?xml version = '1.0'?>
    <testpage>
    <param1/>
    <param2/>
    <xsql-status action="xsql:insert-request" result="No posted document to process"/>
    </testpage>
    null

  • Query handled OK on Oracle server but XSQL Servlet raises OracleXMLSQLException

    After dropping and recreating certain object types, and then using ALTER TYPE on an object dependent on those object types, XSQL Servlet raises exception for a query that is handled fine in the Oracle Server itself (ie, in SQL*Plus) as in the following test case:
    create or replace type o_object_inner as object( char1 char(1) )
    create or replace type n_nested_table as table of o_object_inner
    create or replace type o_object_outer as object (nNestedTab n_nested_table)
    For above, the following query encounters no problems on Oracle Server or in XSQL servlet:
    Select o_object_outer(NULL) as "theOuterObj" from dual
    But then if object types are modified as follows:
    drop type o_object_inner force
    create or replace type o_object_inner as object( char1 char(1) ) --same as above
    drop type n_nested_table force
    create or replace type n_nested_table as table of o_object_inner --same as above
    alter type o_object_outer compile
    The above query now encounters no problems in SQL*Plus but generates exception in XSQL servlet as follows:
    oracle.xml.sql.OracleXMLSQLException: Internal Error: Unable to resolve name
    More complex cases generated the above exception and/or the following exception:
    oracle.xml.sql.OracleXMLSQLException: Internal Error: Invalid ADT attribute
    Any insight or help would be greatly appreciated!
    Other info:
    Oracle Server 8.1.7.3 on HP-UX
    XDK 9.2.0.1 (Production) for Java on NT
    JDBC/OCI8 drivers for NT (latest for 8.1.7)

    Yes,
    I changed most of the cursor functions to cast(multiset()). Sometimes i divided a big query into two or three queries (when there was cursor nested in a cursor). It was one day work for me. Don't forget to change the tags with ROW to ITEM in your xsl-stylesheets.
    Uwe

  • How to Create an XML document from XSQL servlet which follows a particular DTD struct

    how to Create an XML document from XSQL servlet which follows a particular DTD structure.Could anyone send me a sample code for this.

    You'll need to associate an XSLT transformation with your XSQL page that transforms the canonical result into your DTD-valid format.
    For example, given an XSQL page like:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="rss.xsl" ?>
    <xsql:query max-rows="3" connection="demo" xmlns:xsql="urn:oracle-xsql">
    select title,id,description,url,to_char(timestamp,'Mon DD') timestamp
    from site_entry
    order by id desc
    </xsql:query>and an "rss.xsl" stylesheet that looks like this:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" doctype-system="rss-0.91.dtd"/>
    <xsl:template match="/">
    <xsl:for-each select="ROWSET/ROW">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    <xsl:for-each select="ITEM">
    <item>
    <title><xsl:value-of select="TITLE"/></title>
    <link><xsl:value-of select="URL"/></link>
    <description><xsl:value-of select="DESCRIPTION"/></description>
    </item>
    </xsl:for-each>
    </channel>
    </rss>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>You produce DTD-valid output against the rss-0.91.dtd DTD that looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE rss SYSTEM "rss-0.91.dtd">
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>
    <rss version="0.91">
    <channel>
    <title>Do You XML?</title>
    <link>http://xml.us.oracle.com</link>
    <description>Oracle XML Website Demo</description>
    <language>en-us</language>
    </channel>
    </rss>

  • Oracle XSQL Servlet Page Processor 0.9.9.1 (Technology Preview)

    I trying XSQL Servlet in oracle8.1.6,Java Web Server.
    When I access http://localhost:8080/xsql/index.html
    I am getting this error.
    "Oracle XSQL Servlet Page Processor 0.9.9.1 (Technology Preview)
    XSQL-013: XSQL Page URI is null or has an invalid format."
    Any suggestion....
    null

    JWS is not one of the supported Servlet Engines in 1.0.0.0 please see the release notes for supported engines (there are lots of them).
    The XSQL 1.0.1.0 release will support and
    additional set of engines that cause XSQL-013 errors becuase the return null for
    the Servlet API call:
    req.getRealPath(req.getServletPath());

  • ## NEW XSQL Servlet 0.9.9.1 OUT TODAY ##

    The new release of XSQL Pages and the XSQL Servlet is out today here on OTN. For complete information on what's new, and a much-improved "how to install" section, see:
    http://technet.oracle.com/tech/xml/xsql_servlet/htdocs/relnotes.htm
    The brand-new, unified demo, on-line help system is also staged on the live server at:
    http://technet.oracle.com/tech/xml/demo/demo1.htm
    and is included in the release. It's all built using XSQL Pages and XSLT stylesheets.
    Lot's of new features and enhancements based squarely on all of YOUR feedback, here on the OTN XML Forum.
    Keep the questions and suggestions coming.

    Richard,
    I have just applied patch to upgrade from Portal 3.0.9 to 3.0.9.8.1 (Patch applied to loginserver and portal schema) and the External Applications that were previously set up have gone from the portlet.
    Does this relate to your note at the bottom:
    "Minor issues with Bulk action. 1840420 CUSTOM WRITTEN EXTERNAL AUTH MODULE NEED TO BE UPDATED AFTER 3.0.9 UPGRADE SSOXOID.PKB DOESN'T LOAD.
    External authentication modules that were written before 3.0.9 need to be updated after upgrading to 3.0.9. ssoauthx.pks is updated in 3.0.9 and contains additional routines that need to be implemented." ??
    If I go to the "Login Server Administration" portlet and select the link "Administer External Applications" I get a list of 5 External Applications that have previously been set up.
    If I go back to the Home Page and select "customize" on the "External Applications" portlet I get the message "Your Login Server administrator has not registered any external applications".
    Does that mean I should just run 'ssoauthx.pks' & 'ssoxoid.pkb' or do I need to do something else ??
    Thanks
    Simo

  • XSQL servlet & UTF8

    Hi!
    I have oracle8i database. database's charset is UTF8. Initialization parameter NLS_LANGUAGE=Russian
    When I try to fetch data from database using XSQL pages (which proccessed by ORACLE XSQL servlet) through web server I get questions marks ('?') instead of russian's characters.
    When I fetch data using same xsql pages but invoking XSQL from command line(using oracle.xml.xsql.XSQLCommandLine) I get correct characters.
    So, where is problem? config of servlet engine? something else?
    thank you.

    1. What version of XSQL ?
    1.0.1.0 (Production)
    2. What version of the JDK ?
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
    IBM build cx130-20000815
    3. What servlet engine?
    Apache JServ 1.1.2
    In addition I get incorrect national characters only if I select data stored in tables. For example, select to_char(sysdate,'month') from dual
    produce correct output.

  • OAS4.0.8.1 + JSP Patch for XSQL Servlet

    Hi,
    In the release notes for the latest XSQL Servlet it mentions that the servlet will run on OAS 4.0.8.1 wiht the "JSP Patch".
    Can you elaborate what the JSP patch ?
    Is it the JSP download available from technet or is it something I need to download through the PATCHES link in Metalink.
    Thanks

    Hi,
    In the release notes for the latest XSQL Servlet it mentions that the servlet will run on OAS 4.0.8.1 wiht the "JSP Patch".
    Can you elaborate what the JSP patch ?
    Is it the JSP download available from technet or is it something I need to download through the PATCHES link in Metalink.
    Thanks

  • XDL & XSQL servlet, where is it?

    I downloaded the XDK (Java) for windows and cannot find the XSQL servlet that the HTML doc's talk about. Has anyone else ran into this problem?
    Any help is appreciated...thanks!

    Ok I found the Servlet now it seems like there are a lot of discrepencies between the Oracle HTML documentation and the XDK. For instance it tells me:
    "The XSQL Pages distribution includes a ......along with the xsql-wtg.bat script to start the server with all XSQL Servlet settings setup properly."
    Yet I cannot find that Batch file anywhere?
    Any ideas?
    Thanks!
    null

  • XSQL Servlet Insert error

    I understand that this is the more appropriate Forum for my question.
    I am struggling with this one:
    My test XML is well formed:
    <?xml version="1.0"?>
    <SC_ESP>
    <ResultSet>
    <ApplicationID>App0001</ApplicationID>
    <Reason>Sucess</Reason>
    </ResultSet>
    </SC_ESP>
    Whan I try to POST this XML data via the XSQL Servlet
    I get the following error:
    "Character '$' is not allowed in a XML tag name."
    Anyone know what it means ?
    Thanks
    Martin

    Oops sorry folks, I see that the Java Forum has lots to do with the xsql stuff.

  • Problem testing XSQL Servlet, XSQL-0007

    Hi,
    I'm testing the XSQL Servlet, as a lot of people do. I installed
    it on Apache Web Server with JRUN servlet engine, following the
    Release Notes, but it does not work at all. I get the following
    message, when I try to run helloworld.xslq:
    Oracle XSQL Servlet Error
    XSQL-0007: XML Parsing error on requested page
    <2,1>: Expected EOF
    I checked it several times but it seems to be right, exactly as
    in the release notes.
    I read here that other people (SHankar) had the same problem, but
    your answer did not solve it:
    : : Oracle XML Team wrote:
    : : : I presume by XML source code, you are referring to
    the .xsql
    : : : source code. If that is the case then you have not
    : registered
    : : : the XSQL servlet to that extension in the web server you
    are
    : : : using. Check out that section of the installation
    : : instructions.
    Please, tell me what can I do to start testing it, since I can
    test nothing, it does not work.
    Regards,
    Esteban
    null

    Oracle XML Team wrote:
    : The only thing that can cause
    : this error is if the page you
    : are requesting is not a well-formed
    : XML document.
    : Oracle XML Team
    : http://technet.oracle.com
    : Oracle Technology Network
    I'm requesting the page that you provide as a demo:
    helloworld.xsql
    I checked it and it is a well-formed XML document.
    Anyway, other examples that you provide with the xsqlservlet zip
    file don't work either.
    null

  • Oracle XSQL Servlet & IIS4.0

    Is it possible for Oracle XSQL Servlet to work with IIS4.0 ?

    JWS is not one of the supported Servlet Engines in 1.0.0.0 please see the release notes for supported engines (there are lots of them).
    The XSQL 1.0.1.0 release will support and
    additional set of engines that cause XSQL-013 errors becuase the return null for
    the Servlet API call:
    req.getRealPath(req.getServletPath());

  • Can not make XSQL servlet running under Jrun 3.1! need help

    Hi,
    I tried to run Oracle XSQL servlet under JRun 3.1,I did servlet mapping, such as
    <servlet-name>oracle-xsql-servlet</servlet-name>
    <servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>oracle-xsql-servlet</servlet-name>
    <url-pattern>*.xsql</url-pattern>
    </servlet-mapping>
    I set classpath for XSQL related library such as oraclexsql.jar, xmlparserv2.jar,etc, I believe everything is setup correctly, however when I invoke .xsql page, I did not get data instead of getting sql text!, here is my xsql file content:
    <?xml version="1.0"?>
    <!-- reports.xsql: List of reports by user id -->
    <?xml-stylesheet type="text/xsl" href="Filter.xsl"?>
    <page connection="reports_8i" xmlns:xsql="urn:oracle-xsql">
         <dataform target="reportFilter.jsp" submit="Go">
    <xsql:set-session-param name="userid" value="{@userid}" ignore-empty-value="no"/>
         <xsql:include-param name="userid"/>
         <xsql:set-session-param name="bu_id" value="{@bu_id}" ignore-empty-value="no"/>
         <xsql:include-param name="bu_id"/>
         <xsql:set-session-param name="client_id" value="{@client_id}" ignore-empty-value="no"/>
         <xsql:include-param name="client_id"/>
         <item type="list" name="targetPage" label="Available Reports">
         <xsql:ref-cursor-function bind-params="userid">
                   reports_generation.getReportList(?)
              </xsql:ref-cursor-function>
              </item>
         </dataform>
    </page>
    What I got when I invoked this page is reports_generation.getReportList(?)!!
    It seems that JRun 3.1 did not understand xsql syntax, it means it can not find XSQL servlet related libraries, come on, I did set classpath.
    Does anyone has this experience to help me out? Highly appreicate you in advance.
    Thanks.

    i think i solved this problem by specifying the full path to javac...
    what must i do to avoid this?

  • XSQL Servlet and Dynamic SQL

    Does the XSQL servlet support dynamic SQL? Take a stock screening page as an example. In this example you want to dynamically build the where clause based on user input. Thus if a Minimum PE Ratio of 3 was entered, the where clause of "where PE_Ratio >= 3" would be appended to the query. In this case there may be up to 20 different parameters or more to be mapped dynamically, so it wouldn't be feasible to nest all of the different combinations.

    XSQL Supports lexical substitution parameters
    so any and every part of any query can be parameterized.
    The extreme case is:
    <query> {@sql} </query>
    where the entire query is passed in
    in a parameter (named "sql").
    But any combination of parameters
    and substitutions is legal and can
    be used to do what you want.
    Since the variables are not BIND
    variabled, but instead lexical
    substitution variables, you can
    do things like:
    <query>
    select {@collist}
    from {@table}
    where {@where}
    order by {@orderby}
    </query>
    You can provide default parameter values
    using XML attributes on the <query>
    element which then can be overridden
    if a value is passed in in the request...
    <query collist="ename, sal"
    orderby="sal desc"
    where="1=1"
    from="dept">
    select {@collist}
    from {@table}
    where {@where}
    order by {@orderby}
    </query>
    And then a request to the page
    can pass in a orderby=decode(comm,null,1,0)
    or something to override the defaults.
    null

  • Can I use my existing E-mail address to retrieve my password reset through security questions

    Can I use my existing E-mail address to retrieve my password reset through security questions instead of through E-mail. When I try retrieving my new Apple password through reset through security questions?  On the Apple id, it will not allow me to do so becasue I forgot my security answers to the question. I'm naming one or two of the wrong vechiles which is what the questions ask me for for security questions.
    For icloud do you reccommend that I keep that same E-mail address or create a new one for my iCloud mail aside from my G-mail address name?
    I asked support community for the very first time to reset my security questions and it wanted me to create a new user name for iCloud when I already have *****l for my original Apple id.
    <Email Edited By Host>

    TheresaEW,
    I’d recommend contacting Apple directly to resolve your security question issue.

Maybe you are looking for

  • Unable to remove Static Drop entry | 2960 Cam Table

    Hi all, I am facing a strange issue here on a production switch (Cisco 2960 IOS 12.2(55)SE5) I have the following entry in my cam table: switch#show mac add int gi0/10           Mac Address Table Vlan    Mac Address       Type        Ports 123    123

  • Material cost estimate with quantity struchture : problem

    while running the costing transaction CK11N , the word u201Croutingu201D is not appearing under the explanation facilities. rate routing is already available what will be the reason and solution.

  • Apple pro res 422 file consuming more space than usual

    hi everyone! I've been  working with FCP 7 since 2008 and at the same time I started working with Canon T2 from 2 years ago and I haven't had any problems with my FCP workflow files, editing and output used to be H. 264 based files until I started to

  • APO Reports

    Experts, The way we have a std transaction that will list all the reports in a specific module in ECC, is there a similar way/place in APO that I could/look do the same? Are there canned reports in APO as such? I'm looking for reports in APO that wil

  • Webservices and User ID

    We are new to CRMOD and need to develop integration between CRMOD and our ERP system. For that purpose we are using Integraiton Events and Webservices. In general, when using webservices for integration between systems, I expect to connect using an a