Oracle and XML

Hi All,
I have been using Oracle for years, but I am new to processing XML from within Oracle PL/SQL procedure. I have done some research and found that the following packages are useful:
A) To generate XML from a sql query; (i) DBMS_XMLQUERY and (ii) DBMS_XMLGEN
B) For Inserting data from an XML document; (i) DBMS_XMLSAVE and (ii) DBMS_XMLSTORE
Now since I have no experience of using these packages before, I wanted to know which one of the 2 packages for each purpose is best and is normally used? that is, For (A) should I use (i) or (ii), similarly for (B), should I use (i) or (ii)?
An early response will be greatly appreciated
Thanks.

For (A) should I use (i) or (ii), similarly for (B), should I use (i) or (ii)?ALTER SESSION SET SQL_TRACE=TRUE
then run trace file through TKPROF & compare the results of each alternative.

Similar Messages

  • Oracle and XML-DATA

    Hello,
    I have read the Oracle XML SQL Utility documentation and also
    the answer of Oracle team to Johnson Scott and as far as I
    understand, the XML that is produced from the database and
    loaded in it must verify a given DTD syntax.
    Is this DTD available somewhere ?
    What I have understood about XML Data of w3c is that it gives a
    way to describe the content of a database.
    What is Oracle position on that subject ?
    I do ask this question because we have at present an SGML file,
    with its own DTD that contains data we have to
    insert/delete/update in an Oracle Database.
    We are thinking of converting this SGML file in an XML file,
    with tools like OMNIMARK or BALISE, that could be easily
    integrated in the Oracle Database.
    We are looking for the best solution to our problem and think
    that Oracle tools like Oracle XML SQL, parserand Class generator
    could be really usefull.
    What do you think of this problem and of the solution we imagine
    Thanks for your help,
    Best regards,
    C     line.
    null

    Hello,
    I am actually studying the tools that Oracle offers to treat XML
    data.
    When reading the description of your products I can see two
    solutions to my problem.
    I remind it to you :
    I have an SGML file with its own DTD that contains data we have
    to insert/delete/update in an Oracle Database.
    I can imagine two solutions :
    1- one with Oracle IFs XML support :
    To use this one I have to convert my SGML DTD in an XML one
    (they should be very similar) and then write a program that
    would convert my SGML file in an XML one.
    Then create an Oracle iFS document descriptor that indicates how
    each part of my file should be stored in my Oracle database.
    2- an other one with Oracle XML SQL utility :
    To use this one I have to convert my SGML file in an XML file
    that is well-formed (i.e. that Oracle XMLSQL utility can
    understand).
    This convertion is much more difficult to do than the one I have
    described above.
    Are those two solutions correct ?
    If yes, which one is the best in your opinion ?
    Could you use XML Data with Oracle XML SQL utility ?
    Is the DTD you have defined for this tool compiliant with XML
    Data ?
    If not why ?
    I have not the tool from which I can get it but I would be
    interested by the description of this DTD which is the best way
    to see what I can do with this tool (and imagine a solution for
    update if it cannot be easily done).
    I would also be very interested in having the description of DTD
    for Oracle iFS document descriptor files (as far I have
    understood they are XML files) or an example of quite a complex
    one so that I can I an idea of how it cold fit to my problem.
    I have been really impressed by Oracle team very fast answer and
    thank you very much for your help.
    Regards,
    C     line.
    Oracle XML Team wrote:
    : LESCOP (guest) wrote:
    : : Hello,
    : : I have read the Oracle XML SQL Utility documentation and
    also
    : : the answer of Oracle team to Johnson Scott and as far as I
    : : understand, the XML that is produced from the database and
    : : loaded in it must verify a given DTD syntax.
    : : Is this DTD available somewhere ?
    : The output XML from the XML SQL Utility is in canonical form.
    : There is a commandline option to have the corresponding DTD
    : created on output.
    : : What I have understood about XML Data of w3c is that it
    gives
    : a
    : : way to describe the content of a database.
    : : What is Oracle position on that subject ?
    : The W3C Working Group charged with this tsk is the XML Schema
    WG
    : on which we are participating. Our position is supportive of
    : this effort.
    : : I do ask this question because we have at present an SGML
    : file,
    : : with its own DTD that contains data we have to
    : : insert/delete/update in an Oracle Database.
    : : We are thinking of converting this SGML file in an XML file,
    : : with tools like OMNIMARK or BALISE, that could be easily
    : : integrated in the Oracle Database.
    : : We are looking for the best solution to our problem and
    think
    : : that Oracle tools like Oracle XML SQL, parserand Class
    : generator
    : : could be really usefull.
    : : What do you think of this problem and of the solution we
    : imagine
    : Our current components will simplify your task. Currently,
    : update is a bit more of a problem than insert and delete and
    : would need to be handles at the application level for now.
    : Oracle XML Team
    : http://technet.oracle.com
    : Oracle Technology Network
    null

  • Persuading Boss on benefits of ORacle and XML

    We had reports built with VB6 running against Oracle 9i to create Excel reports:
    ) User request a report from ASP web interface.
    2) VB6 makes inline call to ORacle 9i to create reports. There is a call for each data cell. (a YTD report can take over 1 hour to run)
    3) VB6 creates Excel report and put in a directory on the same database server. (Directory contains roughly 13000 files from beginning of 2008)
    4) 1 hour+ later, the user goes back to the interface to see if report has completed.
    In March, vendor made us move to Oracle 10g otherwise no support.
    I have redesigned the system to VB.NET and now create PDF files instead of XL, using ITextSharp. I've also moved code from program into stored procedures that enable program to make only 1 call to database. End result:I can run report 4 reports in less than 45 seconds.
    1) REquest report from interface
    2) Assuming there is no timeout, receives report both in browser and hard-disk in 45 seconds.
    I have other ideas about which for which I solicit your opinions:
    1) The data that populates reports becomes stagnant after 2 months because no one is making changes to the data. Why not take these PDF reports or the raw XML and store in database. Give each report a key, and design another table with woth a "dataChanged" flag that will be set if data has changed (via a trigger maybe). When a request is made for a report over 2 months old, program will check the data-changed flag and run the report again, other the report from the database will be served. This way we avoid a directory of 10000 files where it takes 45 seconds to download a file to Excel, or PDF for that matter, for viewing. ( I work for a small franchise, but I really think this scenario would be helpful in doctors office)
    2) XML and PDF are intutive for me. IT is the way that the industry has moved. Some very smart people had a meeting a long time ago, analyzed the benefits of moving to this new type of architecture. The industry agreed and conformed. My boss however wants to know the cost-benefit of having files in database vs. having them on hard drive. I could not answer intelligently. Can anyone share their ROI results from this type of architecture?
    3) I'm not a database programmer by default, especially Oracle He also wanted to know how much space would be required to house the XML reports. An average report size is 200kb with 20 new reports on Mondays and 10 on other days. XML would increase the size of data store in DB because there is lots of "just-in-case" data not actually used on reports.
    4) He wants to remove ORacle from the 9i server, which i use as a development platform. (I actually havent used because of some differences between the 2 which would impact some techniques used in stored procedures.) He doesn't see a real use for it mainly because most vendor packages he has looked at have SQL server back-ins because they are Microsoft centric. I would like to keep because you always need a backup server. Also, I can't create database and/or do lots of develpment on the 10g machine because if something goes wrong, vendor will blame us for corrupting data environment. IS he right.
    Several other ideas I have on making a more efficient process but these are the ones about which my boss has had questions.
    Thanks in advance

    1. Sounds like a good idea to me. You can store either XML or PDFs. If you store the PDFs you can find what you need here:
    http://www.morganslibrary.org/reference/dbms_lob.html
    to load and unload them.
    2. Files belong inside the database. The database is backed up ... the file system may not be. The database provides an additional layer of security against deletion. The database also, if you move to 11g (which you should do) and buy the additional license from Oracle that allows use of SecureFile storage additionally is faster than access of files and gives you built in encryption, compression, and deduplication.
    http://www.morganslibrary.org/reference/securefiles.html
    In 11gR2 there is the POSIX DBFS file system where these improvements are greatly enhanced over operating system file capabilities.
    3. I'm not a fan of storing XML. I'd store the PDFs. First off it will be faster and secondly it will take up substantially less storage. There is nothing efficient about using two multibyte tags to store a single byte of data.
    4. He is wrong, most likely, on all accounts. Especially on moving to SQL Server if there is any patient data involved. If you are in the US you will be in violation of HIPAA federal requirements the minute you move to SQL Server as you an not audit access.

  • Oracle and XML Parser

    Hi friends
    I'm trying to load xmlparserv2.jar into the database using loadjava..it is creating and loading the classes successfully but while resolving it's giving an error i.e. referenced object SCOTT.oracle/xml/parser/v2/<ClassName> could not be resolved..
    When i tried to resolve the class using the Alter Java Class command it's resolving..but while using the class in a program...at the time of compilation it shows The class is not resolved..
    Please Help...If there is any other way to resolve a class...or to load a parser in to the database..
    Thanks

    What are the specific ORA-XXX error messages you're getting?

  • How to link oracle with xml

    i want to know the coding to link oracle with xml.tq.

    You're going to need to expand a little on this question, since I'm not quite sure what you mean by "link". What kind of problem are you trying to solve, so we can help... Thanks.
    If you're just starting out with Oracle and XML, a book like Building Oracle XML Applications or the Oracle XML Handbook might be the right place to start, in addition to our own online documentation at http://download.oracle.com/otndoc/oracle9i/901_doc/index.htm

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • Oracle's XML Publisher in JDeveloper and XSQL Servlet

    A While ago, in this thread JDeveloper 10g, XSQL and FOP , was mentioned an ongoing effort for the "integration of Oracle's XML Publisher in JDeveloper and XSQL Servlet", Is this still happening ?, will this be something will be able to use without having to be an Oracle Apps shop? Any additional info would be appreciated.

    Hi,
    is there any progress about XML publisher integration with JDeveloper. I'm right now examining XML publisher but there is no explicit directions and explanations of using XML publisher with jdeveloper.
    any news !?
    best regards...
    --barisk                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Oracle 9i Release 2 and XML

    Can you help me about Oracle 9i Release 2 and XML? I cannot register my schema file.
    Moreover, I don't know how do I create a table of XMLTYPE??
    Thanks for Helps.

    The documents listed in the following page could be a good start point:
    http://otn.oracle.com/tech/xml/doc.html

  • Oracle - Salesforce Integration and xml/BI Reporting

    Hi All,
    Any one has done real-time data integration between oracle and salesforce.com.
    We are using oracle E-Bunsiness suite 11i and salesforce and want to integration between these two applications so that we can generate BI/XML publisher report from salesforce data for users.
    Thanks
    Ravi

    Hi Jorge,
    This is good idea but we have to spend $ for this kind of application.
    I have done with Oracle E-Business Suite 11i (Web service integration).
    Now i can generate any report like Discoverer or BI Publisger report from salesforce data.
    Now i am set.
    Thanks
    Ravi

  • Using XML extraction from Oracle and XSLT data transformation

    Hi
    How can transfer data ie: Using XML extraction from Oracle and XSLT data transformation with java application?
    usually i use to do querying sql, getting data from table assinging to model class then send it to UI. how can i go for XML extraction form oracle?
    thanks

    Sorry, I don't understand what exactly you want to do. And I'm under the impression that you might not know exactly what you want to do as well. Could you explain a bit more detailed what you want to achieve?

  • Pls send me oracle 10g xml desktop publisher ebook and software.

    can any body send me oracle 10g xml desktop publisher ebook and software.
    Thankin you in advance.

    Hi,
    It looks like it is trying to create an account for SAP and getting error. It's permission problem. You may want to continue installation with administration previliges.
    or try restart.
    Thanks,

  • Installing Oracle TEXT and XML DB Components on New Instance

    I was told this may be the best place to ask my quesion
    I have set up a New Instance or Oracle on a Solaris Unix box that already had Oracle 10g installed.
    The instance was created fine, however I need the Oracle Text Component and XML DB Component installed as well.
    Those are not installed with this instance. They are installed on the other instance on the box that was setup when oracle was first installed.
    How can I add these components to this new instance?
    DBCA was not used when the instance was created. The DBA here does not care for this tool.
    Thanks

    Hi,
    the installation of XMLDB is described in the XML manual: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/appaman.htm#sthref2372
    the installation of Text is described on Metalink in document 280713.1.
    A nice document to start is on Metalink, it is document 472937.1. It gives Oracle components and the links how to install the components on different versions of Oracle.
    Herald ten Dam
    Superconsult.nl

  • Getting oracle.j2ee.xml.XMLMessages error while running project in 11g

    when I run a project in JDeveloper 11g for the first time i.,e when it starts the embedded oc4j server, I get "oracle.j2ee.xml.XMLMessages warningException
    WARNING: Exception Encountered" error. I am using TP4. is this a severe error or something we can ignore?
    -Pardha

    hi Pardha
    For questions about JDeveloper 11g you could try this forum:
    "JDeveloper and OC4J 11g Technology Preview"
    JDeveloper and OC4J 11g Technology Preview
    success
    Jan Vervecken

  • What is the difference between Oracle and MySQL

    Hi,
    I would like to know the major difference between Oracle and MySQL. I have a project to generate XML files from database tables, i have used oracle's built XML functions XMLELEMENT, XMLATTRIBUTES, XMLFOREST, XMLAGG. I really want to know if these functions (or) similar functions are supported/availabe in MySQL.
    I am having a hard time to find out best linux distro for installing Oracle11g, so i am planning to switch to MySQL. Please help, Thanks in advance.

    Oracle_Walker wrote:
    Hi,
    <snip>>
    I am having a hard time to find out best linux distro for installing Oracle11g, Then you must be "looking for love in all the wrong places."
    What's so hard about finding a "best linux distro for installing Oracle11g"? The supported distros are listed in the fine Installation Guide for Linux. At the top of the list is Oracle's own Oracle Linux, which is in the same family as Red Hat.
    so i am planning to switch to MySQL. Please help, Thanks in advance.

  • How do I set miminum # of connections for pool with Oracle and Tomcat?

    Hi,
    I can't seem to find any attribute to initialize the number of connections for my connection pool. Here is my current context.xml file under my /App1 directory:
    <Context path="/App1" docBase="App1"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="App1ConnectionPool" auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:oddjob"
    user="app1" password="app1" />
    </Context>
    I've been googling and reading forums, but haven't found a way to establish the minimum number of connections. I've tried all sorts of parameters like InitialLimit, MinLimit, MinActive, etc, with no success.
    Here is some sample code that I am testing:
    package web;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OracleConnection;
    import javax.naming.*;
    import java.sql.SQLException;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.Properties;
    public class ConnectionPool {
    String message = "Not Connected";
    public void init() {
    OracleConnection conn = null;
    ResultSet rst = null;
    Statement stmt = null;
    try {
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env");
    OracleDataSource ds = (OracleDataSource) envContext.lookup("App1ConnectionPool");
    message = "Here.";
         String user = ds.getUser();
    if (envContext == null)
    throw new Exception("Error: No Context");
    if (ds == null)
    throw new Exception("Error: No DataSource");
    if (ds != null) {
    message = "Trying to connect...";
    conn = (OracleConnection) ds.getConnection();
    Properties prop = new Properties();
    prop.put("PROXY_USER_NAME", "adavey/xxx");
    if (conn != null) {
    message = "Got Connection " + conn.toString() + ", ";
              conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME,prop);
    stmt = conn.createStatement();
    rst = stmt.executeQuery("SELECT username, server from v$session where username is not null");
    while (rst.next()) {
    message = "DS User: " + user + "; DB User: " + rst.getString(1) + "; Server: " + rst.getString(2);
    rst.close();
    rst = null;
    stmt.close();
    stmt = null;
    conn.close(); // Return to connection pool
    conn = null; // Make sure we don't close it twice
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    // Always make sure result sets and statements are closed,
    // and the connection is returned to the pool
    if (rst != null) {
    try {
    rst.close();
    } catch (SQLException e) {
    rst = null;
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException e) {
    stmt = null;
    if (conn != null) {
    try {
    conn.close();
    } catch (SQLException e) {
    conn = null;
    public String getMessage() {
    return message;
    I'm using a utility to repeatedly call a JSP page that uses this class and displays the message variable. This utility allows me to specify the number of concurrent web requests and an overall number of requests to try. While that is running, I look at V$SESSION in Oracle and occassionaly, I will see a brief entry for app1 or adavey depending on the timing of my query and how far along the code has processed in this example. So it seems that I am only using one connection at a time and not a true connection pool.
    Is it possible that I need to use the oci driver instead of the thin driver? I've looked at the javadoc for oci and the OCIConnectionPool has a setPoolConfig method to set initial, min and max connections. However, it appears that this can only be set via Java code and not as a parameter in my context.xml resource file. If I have to set it each time I get a database connection, it seems like it sort of defeats the purpose of having Tomcat maintain the connection pool for me and that I need to implement my own connection pool. I'm a newbie to this technology so I really don't want to go this route.
    Any advice on setting up a proper connection pool that works with Tomcat and Oracle proxy sessions would be greatly appreciated.
    Thanks,
    Alan

    Well I did some more experiments and I am able to at least create a connection pool within my example code:
    package web;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OracleConnection;
    import javax.naming.*;
    import java.sql.SQLException;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import java.util.Properties;
    public class ConnectionPool {
    String message = "Not Connected";
    public void init() {
    OracleConnection conn = null;
    ResultSet rst = null;
    Statement stmt = null;
    try {
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env");
    OracleDataSource ds = (OracleDataSource) envContext.lookup("App1ConnectionPool");
    message = "Here.";
         String user = ds.getUser();
    if (envContext == null)
    throw new Exception("Error: No Context");
    if (ds == null)
    throw new Exception("Error: No DataSource");
    if (ds != null) {
    message = "Trying to connect...";
    boolean cache_enabled = ds.getConnectionCachingEnabled();
    if (!cache_enabled){
    ds.setConnectionCachingEnabled(true);
    Properties cacheProps = new Properties();
    cacheProps.put("InitialLimit","5");
         cacheProps.put("MinLimit","5");
    cacheProps.put("MaxLimit","10");
    ds.setConnectionCacheProperties(cacheProps);
              conn = (OracleConnection) ds.getConnection();
    Properties prop = new Properties();
    prop.put("PROXY_USER_NAME", "adavey/xyz");
    if (conn != null) {
    message = "Got Connection " + conn.toString() + ", ";
              conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME,prop);
    stmt = conn.createStatement();
    //rst = stmt.executeQuery("SELECT 'Success obtaining connection' FROM DUAL");
    rst = stmt.executeQuery("SELECT user, SYS_CONTEXT ('USERENV', 'SESSION_USER') from dual");
    while (rst.next()) {
    message = "DS User: " + user + "; DB User: " + rst.getString(1) + "; sys_context: " + rst.getString(2);
    message += "; Was cache enabled?: " + cache_enabled;
    rst.close();
    rst = null;
    stmt.close();
    stmt = null;
    conn.close(OracleConnection.PROXY_SESSION); // Return to connection pool
    conn = null; // Make sure we don't close it twice
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    // Always make sure result sets and statements are closed,
    // and the connection is returned to the pool
    if (rst != null) {
    try {
    rst.close();
    } catch (SQLException e) {
    rst = null;
    if (stmt != null) {
    try {
    stmt.close();
    } catch (SQLException e) {
    stmt = null;
    if (conn != null) {
    try {
    conn.close();
    } catch (SQLException e) {
    conn = null;
    public String getMessage() {
    return message;
    In my context.xml file, I tried to specify the same Connection Cache Properties as attributes, but no luck:
    <Context path="/App1" docBase="App1"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="App1ConnectionPool" auth="Container"
    type="oracle.jdbc.pool.OracleDataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    factory="oracle.jdbc.pool.OracleDataSourceFactory"
    url="jdbc:oracle:thin:@127.0.0.1:1521:oddjob"
    user="app1" password="app1"
    ConnectionCachingEnabled="1" MinLimit="5" MaxLimit="20"/>
    </Context>
    These attributes seemed to have no effect:
    ConnectionCachingEnabled="1" ; also tried "true"
    MinLimit="5"
    MaxLimit="20"
    So basically if I could find some way to get these attributes set within the context.xml file instead of my code, I would be a happy developer :-)
    Oh well, it's almost Miller time here on the east coast. Maybe a few beers will help me find the solution I'm looking for.

Maybe you are looking for

  • XY graph multi plot live points and colour control

    Hi All, I'm trying to do something that should be simple but is proving to be difficult so far. I have had a good look through previous topics and found things similar but not actually what I want. In my experiment I scan intensity vs wavelength. Ide

  • I have Amazon instant video app, and recently downloaded a movie. How and where can I find it?

    I have Amazon instant video app, and recently downloaded a movie. How and where can I find it?

  • Trying to create a product showcase

    This is what I'm trying to replicate. I am using a blank composition to create the basic layout, the 1 big pic with the 3 thumbnails under it. And that part works great, but I can't figure out how to have it so that when the large pic is clicked on,

  • ODBC Errors

    Hi I am very new to the Oracle BIEE and just started to work on Oracle tutorials (OBE) and documents, The SH schema. The first tutorial which is creating repositories went fine and the obtained results were identical to the screen shots in OBE. After

  • Ipad disappearing inbox emails

    I just got an iPad 2 and I have ios 6.0.1 on it. When I first bought it, it came with ios 6. My main email account is a pop3 but there is no sync at all involved. Once it downloads onto my computer or ipad, it's downloaded onto those devices, no chan