PL/SQL DOM Implementation

A question to the group regarding speed of building the DOM tree in memory.
When building a DOM tree with a small number of records and nodes (1 record, 4 nodes) the DOM implementation is relativly efficient, but when implementing a solution with some 300 records each with 20 columns being appended to the DOM tree, the parsing and building of the tree is taking an incredible amount of time (i.e 3 minutes to build tree).
Then, once the tree is built, serialising into a CLOB takes approx 1 minute 45 seconds.
Has anyone else experienced this problem, or know of any reasons why the DOM implementation is so slow.
I am aware the PLSQL XML DOM implementation is simply a wrapper to a JAVA implementation, but to take nearly 4 and a half minutes leaes a lot to be desired.
Any help is appreciated.
Thanks

Please post this message at:
Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

Similar Messages

  • BDB XML DOM Implementation

    Hi all---
    I have some newbie questions about BDB/XML's DOM Implementation and its interaction with Xerces-c.
    We are trying to deploy BDB/XML underneath our current database abstraction layer. The application makes use of Xerces-c and the abstraction layer query/get interfaces return objects of type Xercesc-XXXX::DOMDocument*. I can easily get documents out of BDB/XML and return the DOM to the upper layer by use of the XmlDocument::getContentAsDOM() interface.
    The problem occurs as the upper application layers start to manipulate the Document. For instance, in order to print the document, some code creates a serializer (DOMWriter) using Xerces-c, but when applied to the Document returned by BDB/XML the serializer corrupts the DOM and we get an ugly crash.
    I'm completely new to the intricacies/compatibility issues between DOM implementations---is what I am describing here supported in theory? Or is there a fundamental problem---some incompatibility between a Xerces-c DOMWriter and a BDB/XML DOMDocument?
    fwiw, the error appears to be caused by the Xerces-c memory manager which apparantly has no idea about pages being used by BDB, and is allocating structures on top of BDB objects.
    Any ideas? Advice where to investigate?
    thanks,
    SF

    Steve,
    First, the Xerces-C DOM implementation in BDB XML is not entirely complete, and is mostly read-only from an application perspective. So if you are doing anything to modify the returned DOM you run some risk. It's implemented using Xerces-C 2.7.
    Second, the availability of the Xerces-C DOM in BDB XML has a limited lifetime. It will almost certainly not be availble in the next release of BDB XML, so it's not something you should rely on. You may be best off serializing your results and if you want to manipulate them using Xerces, re-parse it into a DOM implementation that you control. I realize there is loss of efficiency in doing this.
    In our next release there are changes being made (for very good reasons) that make it impossible to maintain the XmlDocument::getContentAsDOM() interface. If we did keep it, we'd just be serializing and re-parsing anyway.
    Regards,
    George

  • PL/SQL DOM for xmtype problem

    Hi!
    I create the procedure:
    CREATE OR REPLACE PROCEDURE test2 IS
    var XMLType;
    doc dbms_xmldom.DOMDocument;
    ndoc dbms_xmldom.DOMNode;
    node dbms_xmldom.DOMNode;
    buf varchar2(2000);
    begin
    var := xmltype('<PERSON> <NAME> ramesh </NAME> </PERSON>');
    dbms_output.put_line('xmltype:'||var.getstringval());
    -- Create DOMDocument handle:
    doc := dbms_xmldom.newDOMDocument(var);
    ndoc := dbms_xmldom.makeNode(doc);
    dbms_xmldom.writetobuffer(doc, buf);
    dbms_output.put_line('xml:'||buf);
    node := dbms_xmldom.getFirstChild(ndoc);
    dbms_output.put_line('name:'||dbms_xmldom.getNodeName(node));
    end;
    so all seems to be ok untill the line:
    doc := dbms_xmldom.newDOMDocument(var);
    the line dbms_output.put_line('xml:'||buf); print ?????????????????
    instead of var value
    and dbms_output.put_line('name:'||dbms_xmldom.getNodeName(node));
    raise an ORA-31020 error with the message "Invalid pl/sql dom node
    hdl" that I think it is meen "the node is no valid".
    If it is anyone who have any ideea, please help me.
    Thanks!
    Gabi

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

  • MakeProcessingInstruction PL/SQL DOM API for XMLType

    Does anyone have a code snippet on how to use makeProcessingInstruction()(PL/SQL DOM API for XMLType)
    Description
    Casts a given DOMNode to a DOMProcessingInstruction, and returns the
    DOMProcessingInstruction.
    Syntax
    FUNCTION makeProcessingInstruction( n DOMNode)
    RETURN DOMProcessingInstruction;
    Thanks in advance

    pieter,
    I think you would want to use xmlview. A schema can be attached to the view definition, thereby creating a schema-based xmltype view.
    ie create view nameview of xmltype
    xmlschema "nameschema.xsd" ELEMENT "namehere"
    as
    select
    xmlelement ("....xmlforest(....(select xmlagg(xmlelement(....
    or something similar.
    see link for more information regarding xml views.
    http://www.vldb.org/conf/2003/papers/S30P02.pdf

  • Trying to use SQL to implement a VPD policy

    could some please help me with the following code :-
    these are the steps i took. i'm trying to implement a VPD(virtual private database) also know as Fine Grained Accessed on my APEX 3.2.1
    ------ login as SYS
    CREATE USER vpd_admin IDENTIFIED BY Password_1 DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
    GRANT CREATE SESSION TO vpd_admin;
    grant create any context to vpd_admin;
    GRANT CREATE PROCEDURE TO vpd_admin;
    grant select on charles.load to vpd_admin;
    grant select on charles.instructor to vpd_admin;
    grant execute on dbms_session to vpd_admin;
    grant execute on dbms_rls to vpd_admin;
    ------ login as vpd_admin
    create or replace context empnum_ctx using set_empnum_ctx_pkg;
    CREATE OR REPLACE PACKAGE set_empnum_ctx_pkg IS
    PROCEDURE set_empnum;
    END;
    CREATE OR REPLACE PACKAGE BODY set_empnum_ctx_pkg IS
    PROCEDURE set_empnum IS
         emp_id NUMBER;
    BEGIN
         SELECT EMPNUM INTO emp_id FROM CHARLES.LOAD
         WHERE upper(username) = nvl(v('APP_USER'), USER);
         DBMS_SESSION.SET_CONTEXT('empnum_ctx', 'empnum', emp_id);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    END;
    END;
    create or replace package vpd_policy as
    function vpd_predicate(schema_name in varchar2, object_name in varchar2)
    return varchar2;
    end;
    create or replace package body vpd_policy as function vpd_predicate(
    schema_name in varchar2 default null, object_name in varchar2 default null)
    return varchar2 as
    BEGIN
         if (USER = 'ADMIN') and (v('APP_USER') is null) or
         (USER = 'MICHAEL.GRAY') and (v('APP_USER') is NULL) then
         return '';
         else
         return '(
              exists (
                   select "INSTRUCTOR"."EMPNUM" as "EMPNUM",
                        "INSTRUCTOR"."FIRSTNAME" as "FIRSTNAME",
                        "INSTRUCTOR"."LASTNAME" as "LASTNAME",
                        "LOAD"."COURSEID" as "COURSEID",
                   "COURSE"."CREDIT" as "CREDIT",
                   "COURSE"."HPW" as "HPW",
                        "LOAD"."CAMPID" as "CAMPID",
                        "LOAD"."YR" as "YR",
                        "INSTRUCTOR"."USERNAME" as "USERNAME",
                        "LOAD"."SEMESTER" as "SEMESTER"
                   from      "COURSE" "COURSE",
                        "INSTRUCTOR" "INSTRUCTOR",
                        "LOAD" "LOAD"
                   where      "INSTRUCTOR"."EMPNUM"="LOAD"."EMPNUM"
                   and      "LOAD"."COURSEID"="COURSE"."COURSEID"
                   and      department_name = (
                             select department_name from departments
                             where upper (assigned_to) = nvl(v('APP_USER'),USER) )
                   or upper(username) = nvl(v('APP_USER'), USER)
         END IF;
    END;
    SQL> show errors
    Errors for PACKAGE BODY VPD_POLICY:
    LINE/COL ERROR
    33/4 PLS-00103: Encountered the symbol "end-of-file" when expecting
    one of the following:
    begin end function package pragma procedure form
    when i reached this point trying to implement the function 'vpd_predicate' i got this error
    any advice will be great,
    thanks

    You didn't specify an END for the package.
    One reason you should always name your END blocks (makes it easier to realize when you've missed one).
    END vpd_predicate;
    END vpd_policy;
    /Also, your package specification doesn't match the body (they need to have identical declarations).
    Also, please format your code like i've done so it's actually readable. Use the tags before and after your code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Pl/sql DOM MakeDocument using a node fails

    I am new to xml and have a question. Below code fails with an error ORA-31183: Node type element cannot be converted to desired type. Question is why can't I make a document by passing in a node to makedocument function. If you see the last statement in below code I am calling xmldom.MakeDocument(node) . what I am trying to do is create a document for each detail child node so that I can use xmldom.getElementsByTagName to get the elements that I need. I think (?) xmldom.getElementsByTagName only takes a document as parameter. Please help
    DECLARE
    myparser DBMS_XMLPARSER.parser;
    indomdoc xmldom.DOMDocument;
    innode xmldom.DOMNode;
    nchild xmldom.DOMNode;
    ngrandchild xmldom.DOMNode;
    ngreatgrandchild xmldom.DOMNode;
    nworksetdoc xmldom.DOMDocument;
    BEGIN
    myParser := DBMS_XMLPARSER.newParser;
    DBMS_XMLPARSER.parse(myParser, 'FCSDIR/smallexport1.xml');
    indomdoc := DBMS_XMLPARSER.getDocument(myParser);
    nchild := xmldom.getFirstChild(xmldom.MakeNode(indomdoc));
    dbms_output.put_line(xmldom.getNodename(nchild));
    ngrandchild := xmldom.getFirstChild(nchild);
    dbms_output.put_line(xmldom.getNodename(ngrandchild));
    ngreatgrandchild := xmldom.getFirstChild(ngrandchild);
    dbms_output.put_line(xmldom.getNodename(ngreatgrandchild));
    nworksetdoc := xmldom.MakeDocument(ngreatgrandchild);
    END;
    /

    I posted an example showing how to build a tree in pl/sql using the xmlparser and xmldom packages.

  • PL/SQL DOM API (dbms_xmldom) -- XML-Schema support ?

    hello,
    I have a very large xml-schema, and al my data is in a relational database.
    I want to create a xml-document according the xml-schema, with a lot of data out of de relational database.
    I think I have to user this dbms_xmldom package, but is their a way to start with the schema. To Create the structure of the document ??
    I read in the oracle documentation that their is xml-schema support, but I can't find how I have to use this.
    Pieter

    pieter,
    I think you would want to use xmlview. A schema can be attached to the view definition, thereby creating a schema-based xmltype view.
    ie create view nameview of xmltype
    xmlschema "nameschema.xsd" ELEMENT "namehere"
    as
    select
    xmlelement ("....xmlforest(....(select xmlagg(xmlelement(....
    or something similar.
    see link for more information regarding xml views.
    http://www.vldb.org/conf/2003/papers/S30P02.pdf

  • Implementing OOP inheritance in T-SQL (not an O/R question)

    Is it possible to cleanly obtain the inheritance benefit of object-oriented programming in T-SQL? 
    This is not about O/R mapping, which has been discussed to death all over the web, but rather specifically about implementing a form of inheritance in T-SQL.
    Here’s why I would ask such an insane question: 
    I maintain a large body of existing T-SQL that implements logic that has to be tightly tied to the database. 
    It’s not heavily declarative (i.e., does not rely heavily on large monolithic SQL statements and set manipulations), because the operations that have to be carried out are by their nature sequential. 
    (And imperative code can be tested in bite-size pieces, whereas huge, tight, brittle declarative SQL is difficult to maintain.) 
    And I can’t rewrite it.
    I’m now faced with the prospect of implementing new functionality, which will have the effect of introducing slight variations across the current
    functionality.  An obvious way to implement this would be with tests and branches in every place where the functionality has to vary. 
    This would spread the new functionality across the existing code in a rather unstructured way, making maintenance difficult. 
    At the other extreme, I could clone the entire codebase, and make the alterations in the cloned code for the new functionality. 
    At run-time, you would call into the correct code.  This would cause incredible code bloat and the attendant maintenance headaches.
    Inheritance and virtual functions would solve this nicely: the common code would be placed in one class, and the parts that vary in two
    other separate classes.  Alas, T-SQL does not implement inheritance.
    There is a third way: 
    implement virtual functions by hand in T-SQL.  At virtual function call sites, you would simply employ a lookup to determine the correct virtual function, and then call it dynamically.
     This could be easily expanded to handle a third set of logic and so on. 
    It would only require modifying the entire codebase once, to insert the virtual function call points. 
    The vtable of virtual functions could be stored as a table in SQL Server. 
    But this sounds like an awful thing to do to future maintainers.
    Has anyone else faced this situation, and how did you address it?  Does anyone know of any other approach that would mimic inheritance
    in T-SQL and/or avoid the uglinesses of the above?  Thanks.

    There is a third way: 
    implement virtual functions by hand in T-SQL.  At virtual function call sites, you would simply employ a lookup to determine the correct virtual function, and then call it dynamically.
    That can be done with
    dynamic SQL.
    However, there is always the ever-present performance requirement with database queries. So a fancy implementation can quickly collapse to plain in-line code stored procedure with performance benefits.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Obtaining org.w3c.dom.html implementation?

    I'm would like to obtain implementations of the org.w3c.dom.html interfaces so that I can create HTML documents/fragments from scratch (as opposed to parsing files). After some pretty lengthy investigation (and much frustration), it looks like I need to (as one possible option) use JAXP to obtain implementation-independent versions of those interfaces. I still can't figure out how to wire everything up.
    Any help would be appreciated.
    Thanks,
    Gary

    I've been able to get an instance of DOMImplementation using the following code:
    private DOMImplementation getDomImplementation() throws ParserConfigurationException {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        return builder.getDOMImplementation();
        // // get an instance of the DOMImplementation registry
        // DOMImplementationRegistry registry =
        // DOMImplementationRegistry.newInstance();
        // // get a DOM implementation the Level 3 XML module
        // return registry.getDOMImplementation("XML 3.0");
    }I tried casting the returned DOMImplementation to HTMLDOMImplementation but received a cast exception.
    The commented code was actually my first unsuccessful attempt (it would return null). I tried calling
    System.getProperty("org.w3c.dom.DOMImplementationSourceList") just to see what was listed and it also returned null. I'm guessing that maybe I need to configure/install/register/etc. an implementation but I'm not sure where to start with that. I downloaded the J2SE 5.0 source code and discovered the com.sun.org.apache.html.internal.dom package which contains implementations of all the interfaces I need but I'm not sure how to point to them.
    This seems much harder than it should be. Any help would be appreciated.
    Thanks,
    Gary

  • ORACLEWEBROWSET :java.sql.SQLException: No valid JAXP parser property

    Hi I have a servlet that reqeusts an xml from another servlet this is the code:
    URL host = new URL(url);
    HttpURLConnection hostconn = (HttpURLConnection)host.openConnection();
    hostconn.connect();
    BufferedReader xml = new BufferedReader(new InputStreamReader(hostconn.getInputStream()));
    OracleWebRowSet wrs = new OracleWebRowSet();
    wrs.readXml(xml);
    I get the following error when I try to read the xml document (there is a valid xml document being passed):
    java.sql.SQLException: No valid JAXP parser property specified
    at oracle.jdbc.rowset.OracleWebRowSetXmlReaderImpl.readXML(OracleWebRowSetXmlReaderImpl.java:138)
    at oracle.jdbc.rowset.OracleWebRowSet.readXml(OracleWebRowSet.java:83)
    at com.startech.xml.WebRowSetClient.executeSearch(WebRowSetClient.java:65)
    at com.startech.xml.WebRowSetClient.main(WebRowSetClient.java:81)
    Pls could sum1 help thanks

    Hi,
    I hope you got rid of this problem by now. I too faced the same problem today while using OracleWebRowSet.readXML. I could able to find a workaround for this problem i.e.
    I added the required parser information to System.Properties as below:
    Properties p = new Properties(System.getProperties());
    p.put("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
    System.setProperties(p);
    and it worked for me.
    Basically what OracleWebRowSet's implementation for ReadXML method does is, it performs a look up for SAXParserFactory implementations within the System properties - it then looks for any DOM implementation defined in System.properties; if none of them is available then it raises the exception
    java.sql.SQLException: No valid JAXP parser property specified
    - I believe this should work for you too. Please let me know if you got rid of this in any other way.
    Thanks & Regards
    Dandapani

  • How to Use XML and PL/SQL ?

    Hi !
    I have to read the XML file and I have to insert the values into Database by using Pl/SQL.
    I tried with DBDOM. But i have not succeded.
    I faced the UTL_FILE invalid_operation exception.
    Can Anyone give some example to insert the values into table like EMP.
    Thanks in Advance
    Suresh
    null

    Chapter 5 of "Building Oracle XML Applications" is full of PL/SQL-based XML examples, among them, several examples that do just this.
    There are several different approaches to attack the problem. One is more declarative using XSLT transformations and our XML SQL Utility, the other is more programmatic and uses our PL/SQL-based XML Parser's DOM implementation to search for bits you want to insert and insert them.
    The Oracle XSQL Servlet distribution also ships with several examples.

  • Shell commands in pl/sql

    Hi i´m having trouble using this:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:6113176678923179734::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:16212348050
    the code i used is:
    create or replace procedure host( cmd in varchar2 ) as
    status number;
    begin
    dbms_pipe.pack_message( cmd );
    status := dbms_pipe.send_message( 'HOST_PIPE' );
    if ( status <> 0 ) then
         raise_application_error( -20001, 'Pipe error' );
    end if;
    end host;
    I've granted the privileges to run dbms_pipe, BUT when i try to use it, it gets stuck while trying to run :
    exec host('ls -l')
    it doesn't respond....
    then i tryed the part where it uses a shell to see what the procedure is doing, the code is:
    #!/bin/csh -f
    sqlplus tkyte/tkyte <<"EOF" | grep '^#' | sed 's/^.//' > tmp.csh
    set serveroutput on
    declare
    status number;
    command varchar2(255);
    begin
    status := dbms_pipe.receive_message( 'HOST_PIPE' );
    if ( status <> 0 ) then
    dbms_output.put_line( '#exit' );
    else
    dbms_pipe.unpack_message( command );
    dbms_output.put_line( '##!/bin/csh -f' );
    dbms_output.put_line( '#' || command );
    dbms_output.put_line( '#exec host.csh' );
    end if;
    end;
    spool off
    "EOF"
    chmod +x tmp.csh
    exec tmp.csh
    I supose it runs ok, becouse it creates a file named tmp.sch, but i can't really be sure becouse the previous part can't be done.
    another question is that what does tom mean when he says "running this in the background", do i have to do it o does it do it itself.
    what i need to do with this is send a file trough ftp, i've been using this shell named A-ftp.txt:
    ftp -v -n 10.128.0.89 << EOF
    user username password
    bin
    put "$1"
    bye
    EOF
    where $1 is the name of the file. so when i try it trough my procedure it would be:
    exec host('A-ftp.txt name-of-file')
    but it olso gets stuck. I need this urgent!!!! what is the problem??? is there another solution to my problem?? is dbms_pipe the only way???
    the code is the same as in the web page were i retrieved it, so i need to be given instructions in what to change and what to leave it as it is.
    Restrictions:
    I can only use pl/sql
    I have little time
    Thank You in advance

    Restrictions:
    I can only use pl/sql
    I have little timeYou don't say which version of the database you are using. If it's 9.2 or higher you should check out Tim Hall's PL/SQL ftp implementation.
    Cheers, APC

  • Java.sql.Date vs java.util.Date vs. java.util.Calendar

    All I want to do is create a java.sql.Date subclass which has the Date(String) constructor, some checks for values and a few other additional methods and that avoids deprecation warnings/errors.
    I am trying to write a wrapper for the java.sql.Date class that would allow a user to create a Date object using the methods:
    Date date1 = new Date(2003, 10, 7);ORDate date2 = new Date("2003-10-07");I am creating classes that mimic MySQL (and eventually other databases) column types in order to allow for data checking since MySQL does not force checks or throw errors as, say, Oracle can be set up to do. All the types EXCEPT the Date, Datetime, Timestamp and Time types for MySQL map nicely to and from java.sql.* objects through wrappers of one sort or another.
    Unfortunately, java.sql.Date, java.sql.Timestamp, java.sql.Time are not so friendly and very confusing.
    One of my problems is that new java.sql.Date(int,int,int); and new java.util.Date(int,int,int); are both deprecated, so if I use them, I get deprecation warnings (errors) on compile.
    Example:
    public class Date extends java.sql.Date implements RangedColumn {
      public static final String RANGE = "FROM '1000-01-01' to '8099-12-31'";
      public static final String TYPE = "DATE";
       * Minimum date allowed by <strong>MySQL</strong>. NOTE: This is a MySQL
       * limitation. Java allows dates from '0000-01-01' while MySQL only supports
       * dates from '1000-01-01'.
      public static final Date MIN_DATE = new Date(1000 + 1900,1,1);
       * Maximum date allowed by <strong>Java</strong>. NOTE: This is a Java limitation, not a MySQL
       * limitation. MySQL allows dates up to '9999-12-31' while Java only supports
       * dates to '8099-12-31'.
      public static final Date MAX_DATE = new Date(8099 + 1900,12,31);
      protected int _precision = 0;
      private java.sql.Date _date = null;
      public Date(int year, int month, int date) {
        // Deprecated, so I get deprecation warnings from the next line:
        super(year,month,date);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public Date(String s) {
        super(0l);
        // Start Cut-and-paste from java.sql.Date.valueOf(String s)
        int year;
        int month;
        int day;
        int firstDash;
        int secondDash;
        if (s == null) throw new java.lang.IllegalArgumentException();
        firstDash = s.indexOf('-');
        secondDash = s.indexOf('-', firstDash+1);
        if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length()-1)) {
          year = Integer.parseInt(s.substring(0, firstDash)) - 1900;
          month = Integer.parseInt(s.substring(firstDash+1, secondDash)) - 1;
          day = Integer.parseInt(s.substring(secondDash+1));
        } else {
          throw new java.lang.IllegalArgumentException();
        // End Cut-and-paste from java.sql.Date.valueOf(String s)
        // Next three lines are deprecated, causing warnings.
        this.setYear(year);
        this.setMonth(month);
        this.setDate(day);
        if(! isWithinRange(this))
          throw new ValueOutOfRangeException((RangedColumn)this, "" + this);
      public static boolean isWithinRange(Date date) {
        if(date.before(MIN_DATE))
          return false;
        if(date.after(MAX_DATE))
          return false;
        return true;
      public String getRange() { return RANGE; }
      public int getPrecision() { return _precision; }
      public String getType() { return TYPE; }
    }This works well, but it's deprecated. I don't see how I can use a java.util.Calendar object in stead without either essentially re-writing java.sql.Date almost entirely or losing the ability to be able to use java.sql.PreparedStatement.get[set]Date(int pos, java.sql.Date date);
    So at this point, I am at a loss.
    The deprecation documentation for constructor new Date(int,int,int)says "instead use the constructor Date(long date)", which I can't do unless I do a bunch of expensive String -> [Calendar/Date] -> Milliseconds conversions, and then I can't use "super()", so I'm back to re-writing the class again.
    I can't use setters like java.sql.Date.setYear(int) or java.util.setMonth(int) because they are deprecated too: "replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date)". Well GREAT, I can't go from a Date object to a Calendar object, so how am I supposed to use the "Calendar.set(...)" method!?!? From where I'm sitting, this whole Date deprecation thing seems like a step backward not forward, especially in the java.sql.* realm.
    To prove my point, the non-deprecated method java.sql.Date.valueOf(String) USES the DEPRECATED constructor java.util.Date(int,int,int).
    So, how do I create a java.sql.Date subclass which has the Date(String) constructor that avoids deprecation warnings/errors?
    That's all I really want.
    HELP!

    I appreciate your help, but what I was hoping to accomplish was to have two constructors for my java.sql.Date subclass, one that took (int,int,int) and one that took ("yyyy-MM-dd"). From what I gather from your answers, you don't think it's possible. I would have to have a static instantiator method like:public static java.sql.Date createDate (int year, int month, int date) { ... } OR public static java.sql.Date createDate (String dateString) { ... }Is that correct?
    If it is, I have to go back to the drawing board since it breaks my constructor paradigm for all of my 20 or so other MySQL column objects and, well, that's not acceptable, so I might just keep my deprecations for now.
    -G

  • How to specify custom SQL in polling db adapter with logical delete option

    Hi all,
    I am writing a SOA composite app using JDeveloper SOA Suite 11.1.1.4 connecting to a SQL Server db using a polling DB Adapter with the logical delete option to send data to a BPEL process.
    I have requirements which go beyond what is supported in the JDeveloper UI for DB Adapter polling options, namely:
    * update more than one column to mark each row read, and
    * specify different SQL for the logical delete operation based on whether bpel processing of the data polled was successful or not.
    A complicating factor is that the polling involves two tables. Here is my full use-case:
    1) Polling will select data derived from two tables: e.g. 'headers' and 'details' simplified for this example:
    table: headers
    hid - primary key
    name - data label
    status - 'unprocessed', 'processed', or 'error'
    processedDate - null when data is loaded, set to current datetime when row is processed
    table: details
    hid - foreign key pointed at header.hid
    attr - data attribute name
    value - value of data attribute
    2) There is a many:1 relationship between detail and header rows through the hid columns. The db adapter polling SELECT shall return results from an outer join consisting of one header row and the associated detail rows where header.status = 'unprocessed' and header.hid = details.hid. (This is supported by the Jdeveloper UI)
    3) The polled data will be sent to be processed by a bpel process:
    3.1) If the bpel processing succeeds, the logical delete (UPDATE) operation shall set header.status = 'processed', and header.processedDate = 'getdate()'.
    3.2) If bpel processing fails (e.g. hits a data error while processing the selected data) the logical delete (UPDATE) operation shall set header.status = 'failed', header.processedDate = 'getdate()', and header.errorMsg = '{some text returned from bpel}'.
    Several parts of #3 are not supported by the JDeveloper UI: updating multiple columns to mark the row processed, using getdate() to populate a value of one of those column updates, doing different update operations based on the results of the BPEL processing of the data (success or error), and using data obtained from BPEL processing as a value of those column updates (error message).
    I have found examples which describe specifying custom SQL using the polling delete option to create a template then modifying the toplink file(s) to specify custom select and update SQL to implement a logical delete. (e.g. http://dlimiter.wordpress.com/2009/11/05/advanced-logic-in-oracle-bpel-polling-database-adapter/ and http://myexperienceswithsoa.blogspot.com/2010/06/db-adapter-polling-tricks.html). But none of them match what I've got in my project, in the first case because maybe because I'm using a higher version of JDeveloper, and in the second I think because in my case two tables are involved.
    Any suggestions would be appreciated. Thanks, John

    Hi John,
    You've raised a good scenario.
    First of all let me say that the purpose of the DB polling transaction, is to have an option to initiate a process from a DB table/view and not to update multiple fields in a table (or have other complex manipulation on the table).
    So, when choose to update a field in a record, after reading it, you are "telling" the engine not to poll this record again. Sure, i guess you can find a solution/workaround for it, but I don't think this is the way....
    The question now is what to do?
    You can have another DB adapter where you can update the data after finishing the process. In that case, after reading the data (on polling transaction) - update the header.status = 'processed' for example, and after processing the selected data update the rest of the fields.
    Hope it make some sense to you.
    Arik

  • Exception using JAXP transformer on non-default DOM

    Hi!
    I have a problem with the JAXP integration of my own DOM implementation. I've written a compressed core level 1 DOM implementation and integrated it into JAXP by writing a DocumentBuilder and a DocumentBuilderFactory class. Although not 100% of all DOM methods are implemented completely, it works fine for typical xml documents. I can read in a xml document using JAXP by setting the DocumentBuilderFactory setting to my implementation:
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "ddom.jaxp.DDocumentBuilderFactory");
    But if I try to use a Transformer on the document, I get a NoSuchMethodException:
    Exception in thread "main" java.lang.NoSuchMethodError
         at org.apache.xpath.DOM2Helper.getNamespaceOfNode(DOM2Helper.java:348)
         at org.apache.xml.utils.TreeWalker.startNode(TreeWalker.java:281)
         at org.apache.xml.utils.TreeWalker.traverse(TreeWalker.java:119)
         at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:320)
         at ddom.DTreeTester.write(DTreeTester.java:59)
         at ddom.DTreeTester.main(DTreeTester.java:76)
    Unfortunately there is no source code available for JAXP, so I can't really figure what's going wrong. From the exception it is obvious that the Transformer is trying to figure out the namespace before it crashes. As my implementation ony implements DOM level 1 at the moment there is no support for namespaces. But of course this is reported by my DocumentBuilder class, so no calls to such methods hould occur.
    I just wanted to use the identity transformation to produce some nice output files. I would be very happy if anyone could help me with this problem.
    Mathias

    I tried to get more info on the DOM2Helper class, but only found lots of deprecated APIs. There seems to be some work done on internal APIs dealing with that class. Search for "DOM2Helper" in this page http://xml.apache.org/xalan-j/readme.html
    Maybe you just need to get a newer version of Xalan.

Maybe you are looking for