Oracle.xdb.XMLType extract function

I have an external java program that connect to the database using a thick connection so I can use the methods extract and existsNode available with the XMLType from oracle.xdb.XMLType.
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(jdbc:oracle:oci8:@,"user","pwd");
It works fine from the program. When I load the java function in the SQL database I use the default connection
conn = DriverManager.getConnection("jdbc:default:connection:");
and the extract function gives the error java.sql.SQLException.
Is there a way to define the native connection as thin or thick because that was the error I was getting from the client program when I was using thin connection
Thanks
Mirette

Please try and avoid duplicate posts...

Similar Messages

  • Error Missing class: oracle.xdb.XMLType with xdb.jar in JDeveloper 10.1.3

    I am using JDeveloper 10.1.3 and get the following error when executing the web service proxy with my call to the web service( this web service is using class OracleXMLSave with method insertXML):
    I have included the xdb.jar in my project properties libraries of the web service project and added a file group with xdb.jar to the properties of the webservices.deploy. What else needs to be done? This worked in JDeveloper 10.1.2.
    THE ERROR after running proxy in log window:
    java.rmi.ServerException:
    start fault message:
    caught exception while handling request: caught exception while handling request: oracle.classloader.util.AnnotatedNoClassDefFoundError:
         Missing class: oracle.xdb.XMLType
         Dependent class: dbdata2package.DBDataOperations
         Loader: DBData2WSApp-DBData2Operations-WS.web.WebServices:0.0.0
         Code-Source: /D:/h/cots/Oracle/JDeveloper10g10.1.3/j2ee/home/applications/DBData2WSApp-DBData2Operations-WS/WebServices/WEB-INF/classes/
         Configuration: WEB-INF/classes/ in D:\h\cots\Oracle\JDeveloper10g10.1.3\j2ee\home\applications\DBData2WSApp-DBData2Operations-WS\WebServices\WEB-INF\classes
    The missing class is available from the following locations:
         1. Code-Source: /D:/h/cots/Oracle/JDeveloper10g10.1.3/j2ee/home/applications/DBDataWSApp-webservice-WS/WebServices/WEB-INF/lib/xdb.jar (from WEB-INF/lib/ directory in D:\h\cots\Oracle\JDeveloper10g10.1.3\j2ee\home\applications\DBDataWSApp-webservice-WS\WebServices\WEB-INF\lib)
         This code-source is available in loader DBDataWSApp-webservice-WS.web.WebServices:0.0.0.
         2. Code-Source: /D:/h/cots/Oracle/JDeveloper10g10.1.3/j2ee/home/applications/DBDataWSApp-DBDataOperations-WS/WebServices/WEB-INF/lib/xdb.jar (from WEB-INF/lib/ directory in D:\h\cots\Oracle\JDeveloper10g10.1.3\j2ee\home\applications\DBDataWSApp-DBDataOperations-WS\WebServices\WEB-INF\lib)
         This code-source is available in loader DBDataWSApp-DBDataOperations-WS.web.WebServices:0.0.0.
    :end fault message
         at oracle.j2ee.ws.client.StreamingSender._raiseFault(StreamingSender.java:545)
         at oracle.j2ee.ws.client.StreamingSender._sendImpl(StreamingSender.java:390)
         at oracle.j2ee.ws.client.StreamingSender._send(StreamingSender.java:111)
         at dbdata2packageproxy.runtime.DBData2WSSoapHttp_Stub.insertData(DBData2WSSoapHttp_Stub.java:80)
         at dbdata2package.DBData2WSSoapHttpPortClient.insertData(DBData2WSSoapHttpPortClient.java:54)
         at dbdata2package.DBData2WSSoapHttpPortClient.main(DBData2WSSoapHttpPortClient.java:34)
    Process exited with exit code 0.

    Hi,
    actually you increment the index
    pstmt.setString(++idx,inrecord.getCommentID());
    which means you never have an index of 0 but always start with 1
    Frank

  • How do I get unicode characters out of an oracle.xdb.XMLType in Java?

    The subject says it all. Something that should be simple and error free. Here's the code...
    String xml = new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<x>\u2026</x>\n");
    XMLType xmlType = new XMLType(conn, xml);
    conn is an oci8 connection.
    How do I get the original string back out of xmlType? I've tried xmlType.getClobVal() and xmlType.getString() but these change my \u2026 to 191 (question mark). I've tried xmlType.getBlobVal(CharacterSet.UNICODE_2_CHARSET).getBytes() (and substituted CharacterSet.UNICODE_2_CHARSET with a number of different CharacterSet values), but while the unicode characters are encoded correctly the blob returned has two bytes cut off the end for every unicode character contained in the original string.
    I just need one method that actually works.
    I'm using Oracle release 11.1.0.7.0. I'd mention NLS_LANG and file.encoding, but I'm setting the PrintStream I'm using for output explicitly to UTF-8 so these shouldn't, I think, have any bearing on the question.
    Thanks for your time.
    Stryder, aka Ralph

    I created analogic test case, and executed it with DB 11.1.0.7 (Linux x86), which seems to work fine.
    Please refer to the execution procedure below:
    * I used AL32UTF8 database.
    1. Create simple test case by executing the following SQL script from SQL*Plus:
    connect / as sysdba
    create user testxml identified by testxml;
    grant connect, resource to testxml;
    connect testxml/testxml
    create table testtab (xml xmltype) ;
    insert into testtab values (xmltype('<?xml version="1.0" encoding="UTF-8"?>'||chr(10)||'<x>'||unistr('\2026')||'</x>'||chr(10)));
    -- chr(10) is a linefeed code.
    commit;
    2. Create QueryXMLType.java as follows:
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    import java.util.*;
    public class QueryXMLType
         public static void main(String[] args) throws Exception, SQLException
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              OracleConnection conn = (OracleConnection) DriverManager.getConnection("jdbc:oracle:oci8:@localhost:1521:orcl", "testxml", "testxml");
              OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement("select xml from testtab");
              ResultSet rs = stmt.executeQuery();
              OracleResultSet orset = (OracleResultSet) rs;
              while (rs.next())
                   XMLType xml = XMLType.createXML(orset.getOPAQUE(1));
                   System.out.println(xml.getStringVal());
              rs.close();
              stmt.close();
    3. Compile QueryXMLType.java and execute QueryXMLType.class as follows:
    export PATH=$ORACLE_HOME/jdk/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export CLASSPATH=.:$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$ORACLE_HOME/jlib/orai18n.jar:$ORACLE_HOME/rdbms/jlib/xdb.jar:$ORACLE_HOME/lib/xmlparserv2.jar
    javac QueryXMLType.java
    java QueryXMLType
    -> Then you will see U+2026 character (horizontal ellipsis) is properly output.
    My Java code came from "Oracle XML DB Developer's Guide 11g Release 1 (11.1) Part Number B28369-04" with some modification of:
    - Example 14-1 XMLType Java: Using JDBC to Query an XMLType Table
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb11jav.htm#i1033914
    and
    - Example 18-23 Using XQuery with JDBC
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#CBAEEJDE

  • Trying to get UTF-8 data in and out of an oracle.xdb.XMLType

    I need to be able to put unicode text into an oracle.xdb.XMLType and
    then get it back out. I'm so close but it's still not quite working.
    Here's what I'm doing...
    // create a string with one unicode character (horizontalelipsis)
    String xmlString = new String(
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
    "<utf8>\n" +
    " <he val=\"8230\">\u2026</he>\n" +
    "</utf8>\n");
    // this is an oci8 connection
    Connection conn = getconnection();
    // this works with no exceptions
    XMLType xmlType = XMLType.createXML(conn, xmlString);
    // this is the problem here - BLOB b does not contain all the bytes
    // from xmlType. It seems to be short 2 bytes.
    BLOB b = xmlType.getBlobVal(871);
    String xmlTypeString = new String(b.getBytes(1L, (int) b.length()), "UTF-8");
    PrintStream out = new PrintStream(System.out, true, "UTF-8");
    out.print(xmlTypeString);
    out.close();
    What I get from this is this...
    <?xml version="1.0" encoding="UTF-8"?>
    <utf8>
    <he val="8230">[utf-8 bytes]</he>
    </utf8
    In the above, [utf-8 bytes] represents the correctly encoded UTF-8 bytes that
    were returned. But the output is missing the final closing bracket and the
    newline at the end. It seems that no matter what second argument I give b.getBytes(),
    it always returns the above. Even
    It seems that this code...
    BLOB b = xmlType.getBlobVal(871);
    always returns a BLOB that contains a few bytes short of what it should contain.
    What am I doint wrong? I'm sure I'm missing something here.
    Thanks much for your help.
    Here's info about the environment I'm working in.
    ============================ SYSTEM INFORMATION ============================
    SQL*Plus: Release 11.1.0.7.0 - Production on Fri May 15 11:54:34 2009
    select * from nls_database_parameters
    where parameter='NLS_CHARACTERSET'
    returns...
    WE8ISO8859P1
    select * from nls_database_parameters
    where parameter='NLS_NCHAR_CHARACTERSET'
    returns...
    AL16UTF16
    The operating system I'm working with is...
    SunOS hostname 5.10 Generic_120011-14 sun4u sparc SUNW,Netra-T12

    WE8ISO8859P1 does not support the ellipsis character. It is a WE8MSWIN1252 character. I wonder if your problem may have something to do with internal conversion to/from XML character reference (&#x2026). Unfortunately, I have no time to test. Please, try to use a simple loop and System.out.print to print all bytes of the return value of b.getBytes(1L, (int) b.length()). Also, check the value of b.length().
    -- Sergiusz

  • Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType

    I have the following code written in java in a unix box and this is the error I get when compiling the code. I am not able to find which specific jar or class file I need, Kindly help.
    XMLHelper.java:0: Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType.
    ^
    1 error
    OracleResultSet orst = .... some code to get data
    orst.next();
    //either of the following 2 lines give the same error
    //XMLType dXml = XMLType.createXML(orst.getOPAQUE(1)) ;
    XMLType dXml = (XMLType)orst.getObject(i);
    xmlDoc = dXml.getDOM();
    Please help

    Hello,
    from the little information in your post i would say try to import oracle.sql.*, oracle.jdbc.* and oracle.xdb.*. Make sure your project can access the following libraries ojdbc14.jar and xdb.jar.
    Regards, Marc

  • Missing oracle/xdb/XMLType

    Hi,
    I am developing simple java class to try xsu.
    I am using jdev 10.1.2.1.
    I have done java class to generate xml using OracleXMLQuery.
    It works fine.
    I have done java class to save data from xml using OracleXMLSave.
    It doesn't work!
    The code is simple:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:db10g2","hr","hr");
    OracleXMLSave sav = new OracleXMLSave(conn, "DEPARTMENTS");
    sav.insertXML(sav.getURL("file://c:/xmldb/insertDEPT.xml"));
    sav.close();
    during runtime at line "sav.insertXML(sav.getURL("file://c:/xmldb/insertDEPT.xml"));"
    I got an exception:
    java.lang.NoClassDefFoundError: oracle/xdb/XMLType
         at model.TESTXML_2.main(TESTXML_2.java:20)
    Exception in thread "main" Process exited with exit code 1.
    Jdev has access to all jars in ORACLE_HOME\LIB.
    What is wrong ?
    I don't know where I can find such package oracle.xdb.
    regards,
    Cezary

    You need xdb.jar in $ORACLE_HOME/rdbms/jlib

  • XSQL Error. Missing class: oracle.xdb.XMLType XML

    I am using OC4J and XSQL to publish information and most of the normal stuff runs fine. When I try to run the following query, I get errors. I copied the following example from XML developer's kit manual and work fine in SQL*Plus.
    =============================
    <?xml version="1.0"?>
    <xsql:query connection="demo" xmlns:xsql="urn:oracle-xsql">
    select XmlElement("DepartmentList",
    XmlAgg(
    XmlElement("Department",
    XmlAttributes(deptno as "Id"),
    XmlForest(dname as "Name"),
    (select XmlElement("Employees",
    XmlAgg(
    XmlElement("Employee",
    XmlAttributes(empno as "Id"),
    XmlForest(ename as "Name",
    sal as "Salary",
    job as "Job")
    from emp e
    where e.deptno = d.deptno
    ) as result
    from dept d
    order by dname
    </xsql:query>
    ====================
    Following is the header portion of the errors shown.
    XML-25017: Unexpected Error Occurred
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
    Missing class: oracle.xdb.XMLType
    Dependent class: oracle.xml.sql.core.OracleXMLConvert
    Loader: oracle.xml:10.1.0_2
    Code-Source: /C:/oracle/oc4j_1013/lib/xsu12.jar
    Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\oracle\oc4j_1013\j2ee\home\oc4j.jar
    The missing class is available from the following locations:
    1. Code-Source: /C:/oracle/oc4j_1013/j2ee/home/applications/xsql/xsql/WEB-INF/lib/xdb.jar (from WEB-INF/lib/ directory in C:\oracle\oc4j_1013\j2ee\home\applications\xsql\xsql\WEB-INF\lib)
    This code-source is available in loader xsql.web.xsql:0.0.0.
    I tried to search several forums but was unable to find any solution to resolve this issue. Any help is appreciated.
    Thanks,

    I am using OC4J and XSQL to publish information and most of the normal stuff runs fine. When I try to run the following query, I get errors. I copied the following example from XML developer's kit manual and work fine in SQL*Plus.
    =============================
    <?xml version="1.0"?>
    <xsql:query connection="demo" xmlns:xsql="urn:oracle-xsql">
    select XmlElement("DepartmentList",
    XmlAgg(
    XmlElement("Department",
    XmlAttributes(deptno as "Id"),
    XmlForest(dname as "Name"),
    (select XmlElement("Employees",
    XmlAgg(
    XmlElement("Employee",
    XmlAttributes(empno as "Id"),
    XmlForest(ename as "Name",
    sal as "Salary",
    job as "Job")
    from emp e
    where e.deptno = d.deptno
    ) as result
    from dept d
    order by dname
    </xsql:query>
    ====================
    Following is the header portion of the errors shown.
    XML-25017: Unexpected Error Occurred
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
    Missing class: oracle.xdb.XMLType
    Dependent class: oracle.xml.sql.core.OracleXMLConvert
    Loader: oracle.xml:10.1.0_2
    Code-Source: /C:/oracle/oc4j_1013/lib/xsu12.jar
    Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\oracle\oc4j_1013\j2ee\home\oc4j.jar
    The missing class is available from the following locations:
    1. Code-Source: /C:/oracle/oc4j_1013/j2ee/home/applications/xsql/xsql/WEB-INF/lib/xdb.jar (from WEB-INF/lib/ directory in C:\oracle\oc4j_1013\j2ee\home\applications\xsql\xsql\WEB-INF\lib)
    This code-source is available in loader xsql.web.xsql:0.0.0.
    I tried to search several forums but was unable to find any solution to resolve this issue. Any help is appreciated.
    Thanks,

  • To import oracle.xdb.XMLTYPE;

    Hi,
    Which library I must import in order to use oracle.xdb.XMLTYPE?

    ORA_HOME\rdbms\jlib\xdb.jar

  • Where can i find oracle.xdb.XMLType?

    Hello all!
    Plz someone can help me?
    Thx very much!

    Hi,
    You cand find it in oracle.xdb package.
    For this you need to download the Oracle XDK.
    You can download Oracle XDK for java @
    http://otn.oracle.com/software/tech/xml/xdk_java/index.html
    and Oracle XDK for C++ @
    http://otn.oracle.com/software/tech/xml/xdk_cpp/index.html
    JN

  • ClassNotFoundException oracle.xdb.XMLType

    I cannot seem to get past this line when debugger an XML Application. It always fails on the setXSLT call. I need to debug this since it works sometimes and not all the time.
    public static String GetXML(String in_SQL) {
    String retStr = null;
    try {
    Connection conn;
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:zeusdb", "Dave", "n58XDhp7");
    OracleXMLQuery qry;
    qry = new OracleXMLQuery(conn, in_SQL);
    Reader xsltReader = new FileReader(new File("c:/UFM/OracleRoadsideUFMToSunPass.xslt"));
    qry.setXSLT(xsltReader, null);
    retStr = qry.getXMLString();
    System.out.println(retStr);
    qry.close();
    } catch(SQLException e){System.err.println(e.getMessage()); }
    catch (FileNotFoundException e) { System.err.println(e.getMessage());}
    return retStr;
    Exception breakpoint occurred at line 200 of URLClassLoader.java.
    java.lang.ClassNotFoundException: oracle.xdb.XMLType

    Please add lib/xdb.jar to classpath.

  • Oracle xdb xmltype escape character

    Hi to all, my name is Gianluca.
    I have a question to ask.
    we are developing a web application with two two different environment, one of development and another one of test.
    In each of this is installed Oracle Database 10g Enterprise Edition Release 10.2.0.3.0.
    In development environment if i execute an xdb query from client like sqlplus or toad the ' character is not escaped and the query results is something like this:
    SQL> select * from pippo;
    DATI_XML
    <xml>societa'</xml>
    In test environment if i execute the some query the result is:
    SQL> select * from pippo;
    DATI_XML
    <xml>societa&apos;</xml>
    What is the cause of the different behavior?
    Thanks in advantage.

    Thank you very match for your reply.
    Follow information that you requires:
    DEVELOPMENT ENVIRONMENT:
    SQL> desc pippo
    Nome Nullo? Tipo
    DATI_XML XMLTYPE
    SQL> select dbms_metadata.get_ddl('TABLE','PIPPO', user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','PIPPO',USER)
    CREATE TABLE "SIGFIUSER"."PIPPO"
    ( "DATI_XML" "SIGFIUSER"."XMLTYPE"
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "SIGFIDB"
    XMLTYPE COLUMN "DATI_XML" STORE AS CLOB (
    TABLESPACE "SIGFIDB" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
    NOCACHE LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
    insert into pippo values ('<?xml version=''1.0'' encoding=''UTF16''?><xml>societa'' </xml>');
    SQL> select * from pippo;
    DATI_XML
    <?xml version='1.0' encoding='UTF16'?><xml>societa' </xml>
    TEST               ENVIRONMENT:
    SQL> desc pippo
    Nome Nullo? Tipo
    DATI_XML XMLTYPE
    SQL> select dbms_metadata.get_ddl('TABLE','PIPPO', user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','PIPPO',USER)
    CREATE TABLE "SIGFIUSER"."PIPPO"
    ( "DATI_XML" "SIGFIUSER"."XMLTYPE"
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "SIGFIUSER"
    XMLTYPE COLUMN "DATI_XML" STORE AS CLOB (
    TABLESPACE "SIGFIUSER" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
    NOCACHE LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
    insert into pippo values ('<?xml version=''1.0'' encoding=''UTF16''?><xml>societa'' </xml>');
    SQL> select * from pippo;
    DATI_XML
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <xml>societa&apos; </xml>
    Regards,
    Gianluca

  • Query Oracle 9i xmltype tables

    Hi,
    I have created a table of xmltype and loaded a large xml document of size ~47 MB.
    I wish to execute the following query on the table(OracleBench_No_Schema) using Oracle thin driver.
    select extract(value(X), '//eNest[@aSixtyFour=2]')
    from OracleBench_No_Schema X;
    can you provide me with a skeleton code for running such queries using a java program?
    thanks in advance.
    Dayal

    Hi ,
    java version 1.4.2
    I am using oracle jdbc drivers for java 1.4
    I am using the thin driver.
    This is the code that I am currently using...
    import java.util.Iterator;
    import org.w3c.dom.Node;
    import java.sql.*;
    import java.io.*;
    import oracle.xquery.*;
    import oracle.xquery.exec.*;
    import oracle.xml.parser.v2.*;
    import oracle.xdb.XMLType;
    import oracle.sql.OPAQUE;
    import oracle.xdb.XMLType;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OraclePreparedStatement;
    import oracle.jdbc.OracleResultSet;
    public class OracleXMLTypeQuery
    public static void main(String[]args)
    String query = "select extract(value(X), '//eNest[@aSixtyFour=2]').getClobVal() \n" +
    "from OracleBench_No_Schema X";
    try
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@138.87.169.78:1521:itkora2","dmuruku","dmuruku");
    OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement(query);
    System.out.println("Executing Query...");
    OracleResultSet orset = (OracleResultSet)stmt.executeQuery();
              System.out.println("Query Executed....");
    while(orset.next())
    oracle.sql.CLOB clob = orset.getCLOB(1);               
         Reader reader = clob.getCharacterStream();
    //----------------These set of lines when included in the program are causing protocol violation---------
    StringBuffer clobBuffer = new StringBuffer();
                   char[] buffer = new char[1024];
                   int readCount;
                        while ( (readCount = reader.read(buffer)) != -1)
                             {        clobBuffer.append(buffer, 0, readCount);    }
                   //This included...protocol violation          
    conn.close();
    catch(Exception ex)
    System.out.println(ex.toString());
    As I mentioned the lines of code between the two commenting lines when Included in the program are causing a protocol violation.
    (java.io.IOException: Protocol Violation).
    Is there any other way to read data from a Reader Object into a file or to display it on the console output?
    please advise
    Thanks
    DL

  • Java Stored Procedures + oralce.xdb.XMLType + initxdbj.sql

    In order to use XMLType object in java stored procedures, I need to import oralce.xdb.XMLType package. I got compiler error saying "Class oracle.xdb.XMLType not found" (See List1).
    I check my installed package, sure enough these is no "oracle/xdb/XMLType" or any xdb related one. (See list2) This surprises me since my 9i/Solaris installation was successful and spotless one.
    The 9i App Dev - XML doc states that script $ORACLE_HOME/rdbms/admin/initxdbj.sql could install that package. (See List3) The fact is no way this script could be found from Oracle901/Solaris8 or Oracle901/NT installations.
    If java program moved to client and included xdb_g.jar in CLASSPATH, then it is fine as Doc declares. It just failed to compile in server as stored procedures.
    Please help, Thanks.
    Andy Ting DBA (301)240-2223, [email protected]

    (now include Listings)
    In order to use XMLType object in java stored procedures, I need to import oralce.xdb.XMLType package. I got compiler error saying "Class oracle.xdb.XMLType not found" (See List1).
    I check my installed package, sure enough these is no "oracle/xdb/XMLType" or any xdb related one. (See list2) This surprises me since my 9i/Solaris installation was successful and spotless one.
    The 9i App Dev - XML doc states that script $ORACLE_HOME/rdbms/admin/initxdbj.sql could install that package. (See List3) The fact is no way this script could be found from Oracle901/Solaris8 or Oracle901/NT installations.
    If java program moved to client and included xdb_g.jar in CLASSPATH, then it is fine as Doc declares. It just failed to compile in server as stored procedures.
    Please help, Thanks.
    Andy Ting DBA (301)240-2223, [email protected]
    ====================================================================
    List 1:
    sql> select NAME,TYPE,SEQUENCE,LINE,substr(text,1,80) TEXT from user_errors order BY 1,2,3,4
    NAME TYPE SEQUENCE LINE
    TEXT
    proto4a/database/XMLTypeTest JAVA CLASS 1 0
    ORA-29535: source requires recompilation
    proto4a/database/XMLTypeTest JAVA SOURCE 1 0
    proto4a/database/XMLTypeTest:11: Class oracle.xdb.XMLType not found in import.
    proto4a/database/XMLTypeTest JAVA SOURCE 2 0
    proto4a/database/XMLTypeTest:12: Class XMLTYPE not found in import.
    proto4a/database/XMLTypeTest JAVA SOURCE 3 0
    Info: 2 errors
    ==============================================================
    List 2:
    sql> select OWNER,OBJECT_NAME,OBJECT_TYPE from all_objects
    where upper(object_name) like '%XMLTYPE%';
    OWNER OBJECT_NAME OBJECT_TYP
    SYS /219cdace_AQxmlTypeInfoRespons JAVA CLASS
    /a341e963_AQxmlTypeInfoRequest
    XMLTYPE TYPE
    XMLTYPE TYPE BODY
    XMLTYPE_LIB LIBRARY
    PUBLIC /219cdace_AQxmlTypeInfoRespons SYNONYM
    /a341e963_AQxmlTypeInfoRequest
    sql> select OWNER,OBJECT_NAME,OBJECT_TYPE from all_objects
    where upper(object_name) like '%XDB%';
    no rows selected
    ====================================================================
    List 3:
    Installing and using oracle.xdb.XMLType class
    The oracle.xdb.XMLType is available in the xdb_g.jar file in the ORACLE_
    HOME/rdbms/jlib where ORACLE_HOME refers to the Oracle home directory.
    Using oracle.xdb.XMLType inside JServer:
    This class is pre-loaded in to the JServer and is available in the SYS schema.
    It is not loaded however, if you have upgraded your database from an earlier
    version. If you need to upload the class into the JServer, you would need to run the
    initxdbj.sql file located in the ORACLE_HOME/rdbms/admin directory, while
    connected as SYS.
    Using oracle.xdb.XMLType on the client:
    If you need to use the oracle.xdb.XMLType class on the client side, then ensure that
    the xdb_g.jar file is listed in your CLASSPATH environment variable.
    =====================================================================

  • Slow to convert Oracle 11g XMLType into Java String or Document

    After retrieving a result set from an Oracle 11g database, it takes roughly 75 seconds to convert the XMLType (this is a structured XML Storage, registered with an xsd) into either a java String or Document. I'm using Java 1.6, have the xdb.jar and xmlparserv2.jar
    This xsd is <100 lines and the xml document is also <100 lines.
    Sample code:
    oracle.xdb.XMLType xml = oracle.xdb.XMLType.createXML((oracle.sql.OPAQUE)rset.getObject("XMLDATA"));
    the other way, but still took just as long:
    XMLType xml = (XMLType)rset.getObject("XMLDATA");
    xml.getStringVal();
    or
    org.w3c.dom.Document doc = xml.getDocument();
    either way of the above ways takes just as long.

    If I put this value into the database table, I can
    see only the date. Time part is missing. Is this the
    problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

  • XML escape sequences for brackets and xmltype.extract

    G'day gang, I'm hoping somebody would be kind enough to help me with the following query please.
    I have a web service that is returning the following XML stream into an XMLType in the database:
    <OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
      <OutOfStockAdviceResult>
      & lt;Response& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;
      & lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;
      & lt;/Response& gt;
      </OutOfStockAdviceResult>
    </OutOfStockAdviceeResponse>You'll note the & lt; and & gt; characters (note to display these strings in OTN I've had to add a space between the & and the lt; or gt;. The spaces don't actually occur in the real XML data coming back).
    What's odd about this XML stream coming back is it is mixing the use of the XML angle brackets with the escape character equivalents (eg. & lt; and & gt;) half way through the XML stream. Is this valid for an XML stream to do this? Any idea what would cause this? Is it possible the source is creating 2 separate XML streams using different character sets and then concatenating them to get this result?
    The reason I'm asking is I'm attempting via PL/SQL to extract the ResponseCode and ResponseMessage tags with the following code:
      v_response_code := XMLType.extract(v_response,
          '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseCode/text()',
          'xmlns="http://abc.org/abcWebServices"').getnumberval;
      v_response_msg  := XMLType.extract(v_response,
          '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseMessage/text()',
          'xmlns="http://abc.org/abcWebServices"').getstringval;Both calls are failing with:
    ORA-30625: method dispatch on NULL SELF argument is disallowedCan anybody point me in the right direction for solving this issue? Is there a way to get the xmltype.extract function to recognize the different character encoding schemes (if they do indeed actually exist)?
    Any help appreciated.
    CM.
    PS. Apologize for the weak subject line.

    Chris
    Since that Serviceis actually returning the escaped representation of '<' and '>' inside OutOfStocAdviceResult, the XML Parser considers that whole block of text to be simply a text node child the parent element, not valid XML. Hence the result of your XPath expressions is null and you get the ORA-30625 when you try to invoke the getNumberVal() and getStringVal() methods, which is the PL/SQL equivilant of a Java Null Pointer Exception.
    You can solve it as follows...
    set define off
    set serveroutput on
    declare
      v_response xmltype;
      v_response_code number(4);
      v_response_msg varchar2(64);
      v_xmltext varchar2(256);
      v_OutOfStockResponse xmltype := xmltype(
    '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices"> 
      <OutOfStockAdviceResult>
        & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt; 
      </OutOfStockAdviceResult>
    </OutOfStockAdviceResponse>');
    begin
      select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
        into v_xmltext
        from dual;
       dbms_output.put_line('Text = ' || v_xmlText);
       v_response := xmltype(v_xmltext);
       v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
       v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
       dbms_output.put_line('Code = ' || v_response_code);
       dbms_output.put_line('Msg = ' || v_response_msg);
    end;Note that like you I had to insert space characters between in the 'lt' and 'gt' escape sequences...
    When this is run you get the following
    SQL> set define off
    SQL> set serveroutput on
    SQL> --
    SQL> declare
      2    v_response xmltype;
      3    v_response_code number(4);
      4    v_response_msg varchar2(64);
      5    v_xmltext varchar2(256);
      6    v_OutOfStockResponse xmltype := xmltype(
      7  '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
      8    <OutOfStockAdviceResult>
      9      & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt;
    10    </OutOfStockAdviceResult>
    11  </OutOfStockAdviceResponse>');
    12  begin
    13    select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
    14      into v_xmltext
    15      from dual;
    16     dbms_output.put_line('Text = ' || v_xmlText);
    17     v_response := xmltype(v_xmltext);
    18     v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
    19     v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
    20     dbms_output.put_line('Code = ' || v_response_code);
    21     dbms_output.put_line('Msg = ' || v_response_msg);
    22  end;
    23  /
    Text =
    <Response><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMes
    sage></Response>
    Code = 0
    Msg = Successful
    PL/SQL procedure successfully completed.
    SQL>Basically we extract the encoded text using extractValue() which will de-escape the escapted characters and then create a new XMLType which we can operate on

Maybe you are looking for

  • IMac or Macbook Pro Can not Decide Need Help

    The iMac or Mac Pro I can't decide which is the best one to get and I need to get a good answer before next Thursday. The 24" iMac with extreme Intel processor or Macbook Pro 17" with 2.6 Intel Processor. I'm into Graphic Design in the winter months

  • How do I import a pdf into Dreamweaver CS4?

    I converted a Golive site to CS4, when I added a new pdf to my newsletter page and linked to it, I get an error message that the file can't be found. Everything looks to be correct. If I link to an older newsletter that was in the Golive site, so was

  • KB3038314 causing IE crash

    hey all, hopefully i have the right forum for this question. the IE cumulative update for the past few months has been causing IE to crash on one of our internal websites. the March update (3032359) has a documented issue with table-based websites (w

  • Count word appearance and show in gridview

    Hello all, I am working on a project with multi tables. In one table the user selects one of 13 categories that they are uploading images to. Each category has a sub category. On the main page , I have a grid view for each category that list the subc

  • Satellite T130 keeps restarting instead of shutting down

    Just bought a refurbished Toshiba Satellite T130 laptop pre-installed with Windows 7, and since we got it, it has had a problem shutting down. When I press Shut Down, it shuts down ok, all the lights go off as if it just shut down, and then a couple