JMS and XML in PL/SQL

I'm prototyping a JMS Listener / XML Parser in PL/SQL. I've not used either technology in conjunction with PL/SQL before, so I'm looking for resources to aid my research.
Our current system is a Java Application that receives JMS messages off of a TIBCO EMS queue, parses the XML payload, and inserts the resulting records into the database using JDBC. What we’re hoping to do is to move all of this inside the database to improve the performance and reduce the network traffic. Recommendations of resources would be greatly appreciated!

My mistake...
exec dbms_aqadm.create_queue_table(queue_table=>'JMSDEMO_QUEUE_TABLE', queue_payload_type=>'sys.aq$_jms_text_message',multiple_consumers=>true);
instead of sys.aq$_jms_text_message, I used sys.xmltype
Once I corrected, things are working fine.

Similar Messages

  • JMS and XML SAX

    I am attempting to pass an XML encoded string from one java class to another using JMS. The SAX implementation requires either a File, InputSource, InputStream, or String uri object in order to parse the XML. I can pass the String as either a String or MessageStream using JMS, but have been unable to cast the MessageStream to InputStream to make it parse correctly (also tried casting to InputSource but am unsure how that works).
    Has anyone else tried this setup to do this sort of thing?
    Any other ideas?
    Thanks,
    Ed.

    If you pass the XML in a String, you then need to convert that String into an input source. I have used the following:
    public static Document parseXMLString(String sXML)
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = factory.newDocumentBuilder();
            Document doc = docBuilder.parse(new InputSource(new StringReader(sXML)));
            Element ndroot = doc.getDocumentElement();
            return doc;
        } catch (javax.xml.parsers.ParserConfigurationException e) {
            // print an error
        } catch (java.io.IOException e) {
            // print an error
        } catch (org.xml.sax.SAXException e) {
            // print an error
        return null;
    }

  • Sql:variable and XML query performance

    Can someone help with sql:variable() in xml queries?  It seems that when I attempt to reference variables with the sql:variable(...) function in an xpath function (exist or nodes) it comes up with a totally different query plan, possibly ignoring
    my secondary indices like the ones for VALUE, PATH.
    But if I replace sql:variable("@p_ObjectIdentifierForReference") with the literal (ie. "ord/p/ord0616.p") then it uses secondary indices more consistently.
    Below you will see an unsuccessful attempt to get the query to "OPTIMIZE FOR" a specific literal value of @p_ObjectIdentifierForReference.  But this doesn't give work.  It doesn't give me a plan using the secondary index I expect.
    Ideally there would be a way to get the sql:variable(...) function to give the same query plan as a literal. Not sure why that isn't the default behavior.
    DECLARE
    @p_ObjectIdentifierForReference
    varchar(500);
    SET
    @p_ObjectIdentifierForReference
    = 'ord/p/ord0616.p';
    WITH
    XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004'
    as D)
    SELECT  
    XREF_FileDataReference.XREF_FileData     
    AS XrefFileData,
    InnerRowNode.value('/D:Reference[1]/D:File-num[1]',
    'int') 
    AS FileNumber,
    InnerRowNode.value('/D:Reference[1]/D:Line-num[1]',
    'int') 
    AS LineNumber
    FROM
    (SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.')
    AS InnerRowNode
     FROM
    XREF.XREF_FileData
    OUTER APPLY
    DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference")
    and @Reference-type = "RUN"]')
    as T(InnerRow)                                                           
    WHERE    DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier
    = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]')
    = 1) 
    AS XREF_FileDataReference
     INNER
    JOIN  XREF.XREF_MemberBuilt  
    ON XREF_MemberBuilt.XREF_FileData  
    = XREF_FileDataReference.XREF_FileData
     INNER
    JOIN  XREF.XREF_FileEntry 
    ON XREF_FileEntry.XREF_FileEntry
    = XREF_FileDataReference.XREF_FileEntry 
    WHERE
    XREF_MemberBuilt.XREF_ProjectBuilt
    = 69
    OPTION(RECOMPILE,
    OPTIMIZE FOR (@p_ObjectIdentifierForReference
    = 'ord/p/ord0616.p')

    I tried to create a "repro" of your query so we can work on it and try and improve it, but I got the best results by just adding text() and [1] to it, eg
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
    InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
    FROM (
    In my main repro, even with a large piece of xml with 100,000 elements, there still wasn't much difference between the queries:
    USE tempdb
    GO
    IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = 'XREF' )
    EXEC( 'CREATE SCHEMA XREF' )
    GO
    IF OBJECT_ID('XREF.XREF_FileData') IS NOT NULL DROP TABLE XREF.XREF_FileData
    CREATE TABLE XREF.XREF_FileData
    rowId INT IDENTITY,
    DataXref XML,
    XREF_FileData INT,
    XREF_FileEntry INT,
    CONSTRAINT PK_XREF_FileData PRIMARY KEY ( rowId )
    GO
    IF OBJECT_ID('XREF.XREF_MemberBuilt') IS NOT NULL DROP TABLE XREF.XREF_MemberBuilt
    CREATE TABLE XREF.XREF_MemberBuilt
    XREF_ProjectBuilt INT,
    XREF_FileData INT
    GO
    IF OBJECT_ID('XREF.XREF_FileEntry') IS NOT NULL DROP TABLE XREF.XREF_FileEntry
    CREATE TABLE XREF.XREF_FileEntry
    XREF_FileEntry INT
    GO
    -- Create larger piece of xml for repro
    ;WITH XMLNAMESPACES ( DEFAULT 'uri:schemas-progress-com:XREFD:0004' ), cte AS (
    SELECT TOP 100000 ROW_NUMBER() OVER ( ORDER BY ( SELECT 1 ) ) rn
    FROM master.sys.columns c1
    CROSS JOIN master.sys.columns c2
    CROSS JOIN master.sys.columns c3
    INSERT INTO XREF.XREF_FileData ( DataXref, XREF_FileData, XREF_FileEntry )
    SELECT
    SELECT
    CASE rn WHEN 9999 THEN 'ord/p/ord0616.p' ELSE CAST( rn AS VARCHAR(20) ) END AS "@Object-identifier",
    'RUN' AS "@Reference-type",
    SELECT
    rn AS "File-num",
    rn * 10 AS "Line-num"
    FOR XML PATH(''), TYPE
    ) AS "*"
    FROM cte
    FOR XML PATH('Reference'), ROOT('Source'), TYPE
    ).query('<Cross-reference xmlns="uri:schemas-progress-com:XREFD:0004">{.}</Cross-reference>'), 1, 100
    INSERT INTO XREF.XREF_FileEntry ( XREF_FileEntry )
    VALUES ( 100 )
    INSERT INTO XREF.XREF_MemberBuilt ( XREF_ProjectBuilt, XREF_FileData )
    VALUES ( 69, 1 )
    GO
    --SELECT * FROM XREF.XREF_FileData
    --SELECT * FROM XREF.XREF_FileEntry
    --SELECT * FROM XREF.XREF_MemberBuilt
    --GO
    -- Add primary XML index
    CREATE PRIMARY XML INDEX xidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    GO
    -- Add value, property and path xml indexes
    CREATE XML INDEX xvalidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR VALUE
    CREATE XML INDEX xpthidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR PATH
    CREATE XML INDEX xprpidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
    USING XML INDEX xidx_XREF_FileData FOR PROPERTY
    GO
    :exit
    DBCC DROPCLEANBUFFERS
    DBCC FREEPROCCACHE
    GO
    DECLARE @p_ObjectIdentifierForReference varchar(500);
    SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
    ;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('/D:Reference[1]/D:File-num[1]', 'int') AS FileNumber,
    InnerRowNode.value('/D:Reference[1]/D:Line-num[1]', 'int') AS LineNumber
    FROM (
    SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.') AS InnerRowNode
    FROM XREF.XREF_FileData
    OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
    WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
    ) AS XREF_FileDataReference
    INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
    INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
    WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
    OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
    GO
    DBCC DROPCLEANBUFFERS
    DBCC FREEPROCCACHE
    GO
    DECLARE @p_ObjectIdentifierForReference varchar(500);
    SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
    ;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
    SELECT
    XREF_FileDataReference.XREF_FileData AS XrefFileData,
    InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
    InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
    FROM (
    SELECT
    XREF.XREF_FileData.XREF_FileData,
    XREF.XREF_FileData.XREF_FileEntry,
    InnerRow.query('.') AS InnerRowNode
    FROM XREF.XREF_FileData
    OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
    WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
    ) AS XREF_FileDataReference
    INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
    INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
    WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
    OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
    GO
    So I guess I'm saying I cannot reproduce your problem on SQL 2008 R2 or SQL 2012.  Does anything about this repro stand out as different from your situation?
    Looking at your query I would say you might consider the following:
    are you really seeing big differences in query duration?
    pretty much ignore estimated plan costs for xml queries
    consider breaking it up; eg carve off the xml then do the joins?  If poor cardinality estimation is part of the problem this might help
    Understand what PATH, PROPERTY and VALUE are for, then only create the ones you need
    do you really have the range of queries that requires all three?
    this is still a great article on xml indexes:
    http://technet.microsoft.com/en-us/library/ms191497.aspx
    What's performance like with the primary xml index only?
    If performance is that important, consider materialising the columns permanently
    I think the buffer_descriptors stuff is a distraction - mostly your cache is warm right?
    plan forcing could be a last resort
    Selective XML indexes in SQL 2012 onwards are great : )  much less storage required for example but much more specific

  • JMSML - XML Based Mark-Up Language for BEA WebLogic JMS and JMX

              JMSML is a Mark-Up language designed and developed to make Java Messaging Service
              (JMS) and Java Management Extensions (JMX) programming easy by hiding all the
              JMS and JMX Java API complexity behind a few, simple, easy to use XML tags.
              Both the White Paper and the binary download are available in dev2dev.beasys.com
              at the link below:
              http://dev2dev.beasys.com/resourcelibrary/whitepapers.jsp?highlight=whitepapers
              Regards
              [email protected]
              

    Hi,
    I finally managed to post a message to ActiveMQ 5.4.2 from WLS 10.3. I created a foreign JMS Server in WLS. I am not sure if you still have this issue, but I was facing this problem and managed to resolve it so posting the reply!
    I placed the activemq-all-5.4.2.jar file in WLS server classpath.
    The settings I used for the Foreign Server are:
    General tab
    JNDI Initial Context Factory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
    JNDI Connection URL: tcp://localhost:61616
    Destinations Tab
    Name: TestQueue
    Local JNDI Name: TestQueue
    Remote JNDI Name: dynamicQueues/TestQueue (I tried with a normal queue, but it didn't work. So used dynamicQueues here. Will try with other queue also)
    Connection Factories Tab
    Name: AMQConnectionFactory (
    Local JNDI Name: AMQConnectionFactory
    Remote JNDI Name: ConnectionFactory (This is default name given by Active MQ, you can change by adding names in jndi.properties file and placing it in config folder of ActiveMQ installation. Please check here: http://activemq.apache.org/jndi-support.html)
    Using this configuration I was able to post message to ActiveMQ queue from Oracle Service Bus. One more issue to be taken care is that if the message type is not "Text" then the message body was coming as blank in ActiveMQ. So set the message type as "Text" explicitly.

  • XDK for PL/SQL and XML Parser for PL/SQL

    Is there a difference between the terms:
    XDK for PL/SQL
    and
    XML Parser for PL/SQL V2
    or are they the same thing...?
    cheers,

    XDK stands for XML Developer's Kit. There are Oracle XDKs for Java, C, C++, and PL/SQL. These development kits contain building blocks for reading, manipulating, transforming, and viewing XML documents.
    XML Parser is one component of XDK. Other components of XDK are
    XSLT Processor, XSU, XSQL Servlet, XML Class Generator, etc.
    For more information on XDK and its components please refer to:
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96621/adx01bas.htm#1656
    Regards,
    Anupama
    http://otn.oracle.com/sample_code/content.html

  • Dynamic queue name with JMS Queue XML?

    Hi,
    Is it possible to use dynamic queue name with JMS Queue XML?
    I tried using a variable in the JNDI URL, and supply the value in a package. I specified the following in the JNDI URL in the Topology:
    e.g.
    <JMS_RESOURCE>?d=<DTD_FILE>&s=<SCHEMA>&JMS_DESTINATION=#PROJECT_NAME.dest_var
    I declared and set the variable in a package, then tried to load data from the above data server to database. But executing this package gave me the following error:
    7000 : null : java.sql.SQLException: javax.jms.JMSException: Cannot find the target in JNDI (#PROJECT_NAME.dest_var)
    java.sql.SQLException: javax.jms.JMSException: Cannot find the target in JNDI (#PROJECT_NAME.dest_var)
         at com.sunopsis.jdbc.driver.bg.executeQuery(bg.java)
         at com.sunopsis.jdbc.driver.bh.executeQuery(bh.java)
         at com.sunopsis.jdbc.driver.l.f(l.java)
         at com.sunopsis.jdbc.driver.l.executeUpdate(l.java)
         at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execSrcOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    Am I doing it wrongly?
    Thanks!

    hi,
    as it's not in Adapter-Specific Message Properties
    http://help.sap.com/saphelp_nw04/helpdata/en/10/b1b4c8575a6e47954ad63438d303e4/content.htm
    looks like you cannot do it with jms adapter in standard
    use proxy or your own adapter instead
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Connection Problem To "JMS Queue XML"

    Hi.
    I can't connect to the JMS Queue XML.While Creating Data Server using the JMS XML Queue Technology pointing to WLS and the XML document type definition (dtd ) file books.dtd is provided from the local(C:\Documents and Settings\348773\Desktop\XML FILES) directory. The connection details are as below:-
    Definition Tab:
    Connection:
    User: userXXX
    Password: passYYY
    These are user name and password for the application server
    JNDI tab:
    JNDI Authorization: None
    JNDI User/password (same as above)
    JNDI Protocol: Undefined
    JNDI Driver: weblogic.jndi.WLInitialContextFactory
    JNDI URL: http://172.18.41.47:7001?d=C:\Documents and Settings\348773\Desktop\XML FILES\books.dtd&JMS_DESTINATION=jms/demoQueue
    JNDI Resource:eis/ConnFact/Queue
    FYI:-I h'v just copy and pasted the value of JNDI Driver(weblogic.jndi.WLInitialContextFactory) from a document because I don't know how to find the JNDI drivers name for WLS.I think it is a default name.If I'm wrong then Please tell me how to find it.when I test the connection it shows an error like this:-
    java.sql.SQLException: Cannot load connection class because of underlying exception: 'java.sql.SQLException: Cannot load connection class because of underlying exception: 'javax.jms.JMSException: ODI-40201: Cannot create the initial JNDI context)'.'.
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java:1118)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.getLocalConnect(SnpsDialogTestConnet.java:420)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.localConnect(SnpsDialogTestConnet.java:860)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.jButtonTest_ActionPerformed(SnpsDialogTestConnet.java:806)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.connEtoC1(SnpsDialogTestConnet.java:165)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.access$1(SnpsDialogTestConnet.java:161)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$IvjEventHandler.actionPerformed(SnpsDialogTestConnet.java:111)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2319)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
         at java.awt.Component.processMouseEvent(Component.java:6289)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3268)
         at java.awt.Component.processEvent(Component.java:6054)
         at java.awt.Container.processEvent(Container.java:2042)
         at java.awt.Component.dispatchEventImpl(Component.java:4652)
         at java.awt.Container.dispatchEventImpl(Container.java:2101)
         at java.awt.Component.dispatchEvent(Component.java:4483)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2479)
         at java.awt.Component.dispatchEvent(Component.java:4483)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
         at java.awt.EventQueue.access$000(EventQueue.java:85)
         at java.awt.EventQueue$1.run(EventQueue.java:604)
         at java.awt.EventQueue$1.run(EventQueue.java:601)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
         at java.awt.EventQueue$2.run(EventQueue.java:618)
         at java.awt.EventQueue$2.run(EventQueue.java:615)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:175)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:162)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.sql.SQLException: Cannot load connection class because of underlying exception: 'java.sql.SQLException: Cannot load connection class because of underlying exception: 'javax.jms.JMSException: ODI-40201: Cannot create the initial JNDI context)'.'.
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
         at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter.getConnection(OnConnectOnDisconnectDataSourceAdapter.java:74)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ConnectionProcessor.run(LoginTimeoutDatasourceAdapter.java:217)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:139)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: java.sql.SQLException: Cannot load connection class because of underlying exception: 'java.sql.SQLException: Cannot load connection class because of underlying exception: 'javax.jms.JMSException: ODI-40201: Cannot create the initial JNDI context)'.'.
         at com.sunopsis.jdbc.driver.JMSXMLDriver.connect(JMSXMLDriver.java:113)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:409)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:385)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:352)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:331)
         ... 7 more
    Caused by: java.sql.SQLException: Cannot load connection class because of underlying exception: 'javax.jms.JMSException: ODI-40201: Cannot create the initial JNDI context)'.
         at com.sunopsis.jdbc.driver.JMSXMLConnection.<init>(JMSXMLConnection.java:295)
         at com.sunopsis.jdbc.driver.JMSXMLDriver.connect(JMSXMLDriver.java:99)
         ... 11 more
    So,
    please advise
    Thanks
    Anindya

    Hi,
    Hope till now you might have solved this problem.
    If not lets do  this below workout , we had same kind of problem.
    in JNDI tab , you have JNDI authentication, this authentication is for JNDI resources, I am sure you might be using weblogic credentials.
    Steps :
    1. Clear JNDI User : Blank (No value)
    2. Clear Password : Blank (No Value)
    3. set JNDI Authentication as None, regenerate the scenario and check
    For accessing JNDI responses , JMS XML Queue uses Connection parameters from Definition tab.
    Hope this helps

  • XML Schema Collection (SQL Server 2012): How to create an XML Schema Collection that can be used to Validate a field name (column title) of an existing dbo Table of a Database in SSMS2012?

    Hi all,
    I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
    -- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
    -- 14 April 2015 09:15 AM
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'ScottChangDB')
    DROP DATABASE ScottChangDB
    GO
    CREATE DATABASE ScottChangDB
    GO
    USE ScottChangDB
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL, [ID] INT NULL)
    INSERT INTO marvel
    (avenger_name,ID)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8);
    SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
    DECLARE @x XML
    SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
    SELECT
    person.value('Marvel[4]', 'varchar(100)') AS NAME
    FROM @x.nodes('.') AS Tbl(person)
    ORDER BY NAME DESC
    --Or if you want the completed element
    SELECT @x.query('/Marvel[4]/avenger_name')
    DROP TABLE [marvel]
    Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
    Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked  Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
    my SSMS2012:
    -- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
    -- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
    -- [executed: 2 April 2015 15:04 PM]
    -- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
    -- saved in C:\Documents\XQuery-SQLServer2012
    tried to run: 15 April 2015 ??? AM
    USE ScottChangDB;
    GO
    CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
    AS
    N'<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="marvel">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="avenger_name" />
    <xsd:element name="ID" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>';
    GO
    DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
    SET @x = N'<?xml version="1.0"?>
    <marvel>
    <avenger_name>Thor</name>
    <ID>4</ID>
    </marvel>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
    GO
    I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Error While viewing data on XML model- java.sql.SQLException: constante num

    I am trying to read an XML file and I keep getting an error. At first it worked, and the it stopped working. I re-did everthing exactly as first time and I cannot get it work
    Here is what I do :
    1)     Create Physical Architecture under the XML Technology.
    a) we create a Data Server with these data:
              Name: XML_SERIVA_TM_DES
              Technology: XML
              JDBC Driver: com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
              JDBC Url: jdbc:snps:xml?file=c:\Temp\hoy\CRM_CR_CURRENCY.xml&dtd=c:\Temp\hoy\ServiciosSerivaConsultasTypes0.xsd
         b) We place the files xml and xsd files according to the JDBC provided in previous point.
         We click on "Test Connection" and Connection is correct
         c) We create a physical schema under the Data Server created in point a) , with these data:
              Name: XML_SERIVA_TM_DES (After created the name is replaced by XML_SERIVA_TM_DES.Esquema)
              Schema (Schema) : <No Definido> ( not sure of english value, it should be <Undefined>)
              Schema (Work Schema) : <No Definido> ( not sure of english value, it should be <Undefined>)
              Default :It is a checkbox , and it is ticked.
              Under the "Context" tab, we add a logical schema named XML_SERIVA_TM for the "Desarrollo" Context
    2) Create a Model On the Designer Navigator, we expand the "Models" panel
         a) For Organization, We create a "Folder" Model. It is named "XML"
         b) Under the Folder created in a), we create a new Model , with these data:
              Name: XML_SERIVA_TM
              Code: XML_SERIVA_TM
              Technology: XML
              Logical Schema: XML_SERIVA_TM
         c) Do reverse-engineering.
              In the Reverse tab of the model,
                   + "Standard" is selected
                   + Context: "Desarrollo"
                   + The types of objects to reverse-engineer are: Table
              In the Selective reverse tab, we select : New Datastores, Existing Datastores, Objects to reverse.
              All the datastores that appear are checked
              We click on Reverse Engineer in the toolbar menu
              And the reverse engineer is done successfully and the datastores appear in the model panel
         d) We try to test the reverse engineering by clicking on the datastores and select "View Data",
              after click we get the folloging exception (running with Local agent) :
              See com.borland.dx.dataset.DataSetException error code: BASE+66
              com.borland.dx.dataset.DataSetException: constante numérica mal escrita
              Chained exception:
              java.sql.SQLException: constante numérica mal escrita
                   at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
                   at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
                   at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
                   at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.prepareStatement(SnpsXmlConnection.java:1192)
                   at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:597)
                   at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
                   at $Proxy2.prepareStatement(Unknown Source)
                   at com.borland.dx.sql.dataset.Database.createPreparedStatement(Unknown Source)
                   at com.borland.dx.sql.dataset.o.a(Unknown Source)
                   at com.borland.dx.sql.dataset.o.d(Unknown Source)
                   at com.borland.dx.sql.dataset.o.f(Unknown Source)
                   at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
                   at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
                   at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
                   at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
                   at com.sunopsis.graphical.frame.edit.AbstractEditFrameGridBorland.initialize(AbstractEditFrameGridBorland.java:624)
                   at com.sunopsis.graphical.frame.edit.AbstractEditFrameGridBorland.<init>(AbstractEditFrameGridBorland.java:864)
                   at com.sunopsis.graphical.frame.edit.EditFrameTableData.<init>(EditFrameTableData.java:50)
                   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                   at oracle.odi.ui.editor.AbstractOdiEditor$1.run(AbstractOdiEditor.java:153)
                   at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:655)
                   at java.lang.Thread.run(Thread.java:662)
              Caused by: org.hsqldb.HsqlException: constante numérica mal escrita
                   at org.hsqldb.error.Error.error(Unknown Source)
                   at org.hsqldb.error.Error.error(Unknown Source)
                   at org.hsqldb.ParserBase.read(Unknown Source)
                   at org.hsqldb.ParserBase.readThis(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadFromClause(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadTableExpression(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadQuerySpecification(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadSimpleTable(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadQueryPrimary(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadQueryTerm(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadQueryExpressionBody(Unknown Source)
                   at org.hsqldb.ParserDQL.XreadQueryExpression(Unknown Source)
                   at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
                   at org.hsqldb.ParserCommand.compilePart(Unknown Source)
                   at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
                   at org.hsqldb.Session.compileStatement(Unknown Source)
                   at org.hsqldb.StatementManager.compile(Unknown Source)
                   at org.hsqldb.Session.execute(Unknown Source)
                   ... 26 more
    We also try to create an interface with the datastore of the model as source of the interface, and
    get the same exact exception as above, when interfaces in executed either with no-agent(local) or with an agent.
    Bellow I pasted the xsd schema and XML data:
    CRM_CR_CURRENCY.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <m:indicadoresResponse xmlns:m="http://co/com/bancodecredito/eai/serviciosLinea/seriva">
    <ns0:WS_ResultadoConsultaIndicadores xmlns:ns0="http://co/com/bancodecredito/eai/serviciosLinea/seriva/impl">
    <ns0:Error>0</ns0:Error>
    <ns0:Descripcion>Transacción exitosa</ns0:Descripcion>
    <ns0:indicadores>
    <ns0:fecha>2011-08-10 00:00:00.0</ns0:fecha>
    <ns0:descripcion>VALORACION (TRM VIGENTE) UVR/UVR</ns0:descripcion>
    <ns0:tipoIndicador>3</ns0:tipoIndicador>
    <ns0:codigoIndicador>312</ns0:codigoIndicador>
    <ns0:codigoVertice>0</ns0:codigoVertice>
    <ns0:plazo>0</ns0:plazo>
    <ns0:valor>196.9975</ns0:valor>
    <ns0:comportamiento>1</ns0:comportamiento>
    <ns0:formato>3</ns0:formato>
    </ns0:indicadores>
    </ns0:WS_ResultadoConsultaIndicadores>
    </m:indicadoresResponse>          
    ServiciosSerivaConsultasTypes0.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://co/com/bancodecredito/eai/serviciosLinea/seriva" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://co/com/bancodecredito/eai/serviciosLinea/seriva" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s3="http://www.openuri.org/2006/12/wsdl/upgradedJWS" xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:import namespace="http://co/com/bancodecredito/eai/serviciosLinea/seriva/impl" schemaLocation="resultado.xsd" />
         <xs:element name="indicadoresResponse">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="impl:WS_ResultadoConsultaIndicadores" xmlns:impl="http://co/com/bancodecredito/eai/serviciosLinea/seriva/impl" />
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    resultado.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://co/com/bancodecredito/eai/serviciosLinea/seriva/impl" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://co/com/bancodecredito/eai/serviciosLinea/seriva" xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s3="http://www.openuri.org/2006/12/wsdl/upgradedJWS" xmlns:tns="http://co/com/bancodecredito/eai/serviciosLinea/seriva/impl" xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="WS_ResultadoConsultaIndicadores">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Error" type="xs:string" />
                        <xs:element name="Descripcion" type="xs:string" />
                        <xs:sequence maxOccurs="unbounded" minOccurs="0">
                             <xs:element name="indicadores">
                                  <xs:complexType>
                                       <xs:sequence>
                                       <xs:element name="fecha" type="xs:string" />
                                       <xs:element name="descripcion" type="xs:string" />
                                       <xs:element name="tipoIndicador" type="xs:int" />
                                       <xs:element name="codigoIndicador" type="xs:int" />
                                       <xs:element name="codigoVertice" type="xs:int" />
                                       <xs:element name="plazo" type="xs:int" />
                                       <xs:element name="valor" type="xs:double" />
                                       <xs:element name="comportamiento" type="xs:int" />
                                       <xs:element name="formato" type="xs:int" />
                                       </xs:sequence>
                                  </xs:complexType>
                             </xs:element>
                        </xs:sequence>
                   </xs:sequence>
              </xs:complexType>
    </xs:element>
    </xs:schema>
    I really don't have any clue about what is happening. I have made sure files are in UTF-8 encoding. I don't know if any jar might be corrupted.

    You may sure have found the answer but it can help futur visitors:
    Did you specified a Schema name for your physical schema ?
    I had the same problem and no schema was set in my physical schema, when setting it, it must be OK.

  • Error while passing ODI variable in JNDI Url for JMS Queue XML

    Hi,
    Facing a weird problem while passing ODI variable in JNDI Url for JMS Queue XML.
    Below is the JNDI Url configured under ODI Topology:
    JNDI Url: t3://<host_location>?d=#TEST.SCHEMA_FILE&s=<schema_name>&JMS_DESTINATION=jms/<queue_name>
    where,
    #TEST.SCHEMA_FILE --> ODI variable storing xsd name and location
    Issue Description:
    If we restart ODI server then for the first run of any ODI interface using JMS Queue XML, it is unable to get the value for ODI variable present in JNDI Url (d=#TEST.SCHEMA_FILE).
    It throws error message saying: No XSD found
    Temporary Resolution:
    As a temporary fix if we hard-code and pass the value in that ODI variable as shown below, it will successfully go through.
    eg: JNDI Url: t3://<host_location>?d=C:\XSD\test.xsd&s=<schema_name>&JMS_DESTINATION=jms/<queue_name>
    Reverting it back to variable later will have no issues and subsequent run will succeed.
    But again anytime later if server is restarted then first run will have this issue.
    Want to have permanent fix for it.
    Any one having idea on it please share. Appreciate your help!

    What ODI version are you using? It could be related to the bug in the older version as described in support note Doc ID 1290326.1

  • XML Schema Collection (SQL Server 2012): Complex Schema Collection with Attribute - Should xs or xsd be used in the coding?

    Hi all,
    I just got a copy of the book "Pro SQL Server 2008 XML" written by Michael Coles (published by Apress) and try to learn the XML Schema Collection in my SQL Server 2012 Management Studio (SSMS2012). I studied Chapter 4 XML Collection of the book
    and executed the following code of Listing 4-8 Complex Schema with Attribute:
    -- Pro SQL Server 2008 XML by Michael Coles (Apress)
    -- Listing04-08.sql Complex XML Schema with Attribute
    -- shcColes04-08.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress
    -- 6 April 2015 8:00 PM
    CREATE XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute
    AS
    N'<?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="item">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="name" />
    <xs:element name="color" />
    <xs:group ref="id-price" />
    <xs:group ref="size-group" />
    </xs:sequence>
    <xs:attribute name="id" />
    <xs:attribute name="number" />
    </xs:complexType>
    </xs:element>
    <xs:group name="id-price">
    <xs:choice>
    <xs:element name="list-price" />
    <xs:element name="standard-cost" />
    </xs:choice>
    </xs:group>
    <xs:group name="size-group">
    <xs:sequence>
    <xs:element name="size" />
    <xs:element name="unit-of-measure" />
    </xs:sequence>
    </xs:group>
    </xs:schema>';
    GO
    DECLARE @x XML (dbo.ComplexTestSchemaCollection_attribute);
    SET @x = N'<?xml version="1.0"?>
    <item id="749" number="BK-R93R-62">
    <name>Road-150 Red, 62</name>
    <color>Red</color>
    <list-price>3578.27</list-price>
    <size>62</size>
    <unit-of-measure>CM</unit-of-measure>
    </item>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute;
    It worked nicely. But, I just found out the coding that was downloaded from the website of Apress and I just executed was different from the coding of Listing 4-8 listed in the book: all the <xs: ....> and </xs: ..> in my SSMS2012 are
    listed as <xsd:...> and </xsd:...> respectively in the book!!??  The same thing happens in the Listing 4-3 Simple XML Schema, Listing 4-5 XML Schema and Valid XML Document with Comple Type Definition, Listion 4-6 XML Schema and XML
    Document Document with Complex Type Using <sequence> and <choice>, and Listing 4-7 Complex XML Schema and XML Document with Model Group Definition (I executed last week) too.  I wonder: should xs or xsd be used in the XML
    Schema Collection of SSMS2012?  Please kindly help,  clarify this matter and explain the diffirence of using xs and xsd for me.
    Thanks in advance,
    Scott Chang   

    Hi Scott,
    Using xs or xsd depends on how you declare the namespace prefix.
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="item">
    I've posted a very good link in your last question, just in case you might have missed it, please see the below link.
    Understanding XML Namespaces
    In an XML document we use a namespace prefix to qualify the local names of both elements and attributes . A prefix is really just an abbreviation for the namespace identifier (URI), which is typically quite long. The prefix is first mapped to a namespace
    identifier through a namespace declaration. The syntax for a namespace declaration is:
    xmlns:<prefix>='<namespace identifier>'
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • SSMS 2012: Import XML File to SQL Table - 'value' is not a recognized built-in function name!!??

    Hi all,
    I have the following xml file (books1.xml):
    <bookstore>
    <book>
    <BookID>1</BookID>
    <title>Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    <book>
    <BookID>2<BookID>
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    <book>
    <BookID>3<BookID>
    <title>XQuery Kick Start</title>
    <author>James McGovern</author>
    <year>2003</year>
    <price>49.99</price>
    </book>
    <book>
    <BookID>4<BookID>
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
    </book>
    </bookstore>
    In my Microsoft SQL Server 2012 Management Studio, I executed the following SQL Query code:
    --XQuery w3schools example using books1.xml in C:\Temp folder
    ---SQL Query W3books Title
    ---9 March 2015
    USE XML_XQUERY
    GO
    CREATE TABLE W3Books(
    BookID INt Primary Key,
    Title VARCHAR(30));
    INSERT INTO W3Books (BookID, Title)
    SELECT x.book.query('BookID'), value('.', 'INT'),
    x.book.query('title'), value('.', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'C:\Temp\books1.xml',
    SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('W3Books/book') AS x(book);
    SELECT BookID, Title
    FROM W3Books;
    I got the following error messages:
    Msg 195, Level 15, State 10, Line 7
    'value' is not a recognized built-in function name.
    Msg 156, Level 15, State 1, Line 16
    Incorrect syntax near the keyword 'AS'.
    I don't know why I got the error of 'value' is not a recognized built-in function name. Please kindly help and tell me what is wrong in my code and how to correct the error.
    Thanks, Scott Chang
    P. S.
    (1) I mimicked the xml file and SQL Qeury code of Import XML File to SQL Table in
    http://pratchev.blogspot.com/2008/11/import-xml-file-to-sql-table.html. The xml file and the code of this sample worked in my SSMS 2012 program.
    (2) I am learning the "CAST" and "CROSS APPLY" in the Create Instances of XML Data of Microsoft MSDN - it is very abstract to me.

    Hi Stan210, Thanks for your nice response.
    I corrected my xml file as you pointed out.
    I made some changes in some code statements of my SQLQueryW3BookTitle.sql as you instructed:
    --XQuery w3schools example using books1.xml in C:\Temp folder
    ---SQL Query W3books Title
    ---10 March 2015
    USE XML_XQUERY
    GO
    CREATE TABLE W3Books(
    BookID INt Primary Key,
    Title VARCHAR(30));
    INSERT INTO W3Books (BookID, Title)
    SELECT x.book.value('/BookID[1]', 'INT'),
    x.book.value('/title[1]', 'VARCHAR(30)')
    FROM (
    SELECT CAST(x AS XML)
    FROM OPENROWSET(
    BULK 'C:\Temp\books1.xml',SINGLE_BLOB) AS T(x)
    ) AS T(x)
    CROSS APPLY x.nodes('bookstore/book') AS x(book);
    SELECT BookID, Title
    FROM W3Books;
    I executed my revised sql and I got the following Message and Results:
    Msg 515, Level 16, State 2, Line 6
    Cannot insert the value NULL into column 'BookID', table 'XML_XQUERY.dbo.W3Books'; column does not allow nulls. INSERT fails.
    The statement has been terminated.
    (0 row(s) affected)
    Results:
    BookID    Title
    I don't know why I just got the names of columns in Results and the "Cannot insert the value NULL into column 'BookID', table 'XML_XQUERY.dbo.W3Books'; column does not allow nulls, insert fails." in Messages.  Please kindly help, advise me
    how to correct the errors and respond again.
    Many Thanks again,
    Scott Chang

  • ODI 11g : JMS Queue XML Data Server creation

    Hi Everybody,
    I am facing a problem while i am trying to create a JMS Queue XML data server in ODI 11g. I have
    the following details of the queue.
    QueueManager=xxx;
    TransportType=1;
    HostName=ab.cde.fe.com;Port=77777;
    Channel=CLIENT.TO.xxx1
    destination name : SU.BH.RAJY.OTI.UPDATE_ITEM_RESPONSE.01
    user : xyz
    password : 123
    I have sussefully created an jms datasouce in weblogic name 'eis/jms/abc' and also I have successfully
    retrived the xml message from queue in BPEL
    (using a jms adapter where
    JMS Provider : Third Party,
    Jms Provider Jndi Name -eis/jms/abc,
    Operation name : consume_message,
    destinamtion name is queue:///SU.BH.RAJY.OTI.UPDATE_ITEM_RESPONSE.01?targetClient=1).
    But the new reqirement is to retive the xml data in ODI using "JMS Queue XML data server".I have tried
    several ways(reading from internet) but failed to configure physical dataserver and reverse the xml message.
    Also failed to understand properly the oracle post (http://docs.oracle.com/cd/E21764_01/integrate.1111/e12644/jms_xml.htm#CHDFCFBI).
    Speically this portion "JNDI URL: <JMS_RESOURCE>?d=<DTD_FILE>&s=<SCHEMA>&JMS_DESTINATION=<JMS_DESTINATION_NAME>.".
    What will be the "JMS_RESOURCE" in my case.
    How can I configure JMS Queue XML?
    Please help!
    Note : I don't have the XML message structure of the Queue(also DTD file). So , I have to reverse it.
    Thanks & Regards,
    Subhra
    Message was edited by: SubhrajyotiKundu

    Hi Everybody,
    I am facing a problem while i am trying to create a JMS Queue XML data server in ODI 11g. I have
    the following details of the queue.
    QueueManager=xxx;
    TransportType=1;
    HostName=ab.cde.fe.com;Port=77777;
    Channel=CLIENT.TO.xxx1
    destination name : SU.BH.RAJY.OTI.UPDATE_ITEM_RESPONSE.01
    user : xyz
    password : 123
    I have sussefully created an jms datasouce in weblogic name 'eis/jms/abc' and also I have successfully
    retrived the xml message from queue in BPEL
    (using a jms adapter where
    JMS Provider : Third Party,
    Jms Provider Jndi Name -eis/jms/abc,
    Operation name : consume_message,
    destinamtion name is queue:///SU.BH.RAJY.OTI.UPDATE_ITEM_RESPONSE.01?targetClient=1).
    But the new reqirement is to retive the xml data in ODI using "JMS Queue XML data server".I have tried
    several ways(reading from internet) but failed to configure physical dataserver and reverse the xml message.
    Also failed to understand properly the oracle post (http://docs.oracle.com/cd/E21764_01/integrate.1111/e12644/jms_xml.htm#CHDFCFBI).
    Speically this portion "JNDI URL: <JMS_RESOURCE>?d=<DTD_FILE>&s=<SCHEMA>&JMS_DESTINATION=<JMS_DESTINATION_NAME>.".
    What will be the "JMS_RESOURCE" in my case.
    How can I configure JMS Queue XML?
    Please help!
    Note : I don't have the XML message structure of the Queue(also DTD file). So , I have to reverse it.
    Thanks & Regards,
    Subhra
    Message was edited by: SubhrajyotiKundu

  • XML parsing with SQL/PL-SQL

    Hi,
    My question is about how can an XML message can be best parsed using SQL/PL-SQL.
    The scenario is as follow. The XML message is stored in a CLOB; only some of its data needs to be extracted; there are six different types of structures of XML; the size of each XML is about 50 lines (maximum depth level is 3); the data could be written in English or Greek or French or German or Russian; this is going to be done every hour and the parsing is going to be against 3,000 records approx.
    In the development, I need to take into consideration performance. We are using Oracle 10, but we could migrate to Oracle 11 if necessary.
    Apologies for this basic question but I have never done XML parsing in SQL/PL-SQL before.
    Thank you.
    PS I have copied this question to the XML forum.
    Edited by: user3112983 on May 19, 2010 3:30 PM
    Edited by: user3112983 on May 19, 2010 3:39 PM

    user3112983 wrote:
    The scenario is as follow. The XML message is stored in a CLOB; only some of its data needs to be extracted; there are six different types of structures of XML; the size of each XML is about 50 lines (maximum depth level is 3); the data could be written in English or Greek or French or German or Russian; this is going to be done every hour and the parsing is going to be against 3,000 records approx.Parsing is done using the XMLTYPE data type (object class) in Oracle.
    Something as follows:
    SQL> create table xml_doc( id number, doc clob );
    Table created.
    SQL>
    SQL> insert into xml_doc values( 1, '<root><row><name>John</name></row><row><name>Jack</name></row></root>' );
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> declare
      2          rawXml  xml_doc.doc%type;
      3          xml     xmltype;
      4  begin
      5          -- get the raw XML (as a CLOB)
      6          select doc into rawXml from xml_doc where id = 1;
      7
      8          -- parse it
      9          xml := new xmltype( rawXml );  
    10         -- process the XML...
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL>The variable xml in the sample code is the XML DOM object. XML functions can be used against it (e.g. to extract values in a tabular row and column structure).
    Note that the CLOB needs to contain a valid XML. An XML containing XML fragments is not valid and cannot be parsed. E.g.
    SQL> declare
      2          xml     xmltype;
      3  begin
      4          -- attemp to parse fragments
      5          xml := new xmltype( '<row><name>John</name></row>  <data><column>Name</column></data>' );
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 301
    ORA-06512: at line 5This XML contains 2 fragments. A row structure and a data structure. It is not a valid XML and as such cannot be parsed. If a root tag is used to encapsulate these 2 fragments, then it will be a valid XML structure.
    In the development, I need to take into consideration performance. We are using Oracle 10, but we could migrate to Oracle 11 if necessary.Have not run into any XML performance problems specifically - and am using it extensively. Even large XMLs (10's of 1000's of elements) parse pretty fast.

  • Java framework/toolkit for POJO, database persistence and XML

    Hi all,
    I've been wondering if there's a toolkit or framework for developing Java program (could be standalone Java program, EJBs etc.)
    I surfed around casually and found some but there isn't any detailed description of what and how each framework/toolkit does. So I hope to ask around if you've anything that you have used before and would like to point to me to look further.
    Given the huge number of open source toolkits, libraries and frameworks out there, it can be quite confusing as to which one is more suitable for me. Also with Sun's move into JDO and Java Persistence API, things become more messy and complicated - there isn't any clear leader in this area and things are starting to change with the inclusion of JDO which seems to be the future standard persistence API to use.
    So far, I've only worked with Hibernate for database persistence before. So I'm wondering if there're other options such as Hibernate with XDoclet, Castor and Spring framework etc. that can easily transform Plain Old Java Objects (POJO) -- hopefully using Java Reflection w/o using mapping XML files like in Hibernate -- into SQL for database persistence and XML text data and vice-versa. The current problem is that I've been spending tons of time writing code to transform data in Java objects into XML (using my own format) and also doing mapping files for Hibernate.
    I am hoping for something simple like:
    Object o = new Object();
    o.setProperty = "something";
    String xml = o.toXML(); // Convert object to XML text.
    o.save(); // Save to database.
    // The reverse: Parse XML into object and load from database
    Object o = new Object();
    o.fromXML(xml);
    o.load();
    // Properties should be initialized from database or XML.
    Anything similar to this out there?

    Hi,
    Just to share what I've found after surfing a bit more on this issue to promote more discussion on this area.
    For mapping of Java objects to XML, we can try looking more at Castor and JAXB.
    For database persistence to/from Java objects, look at Hibernate and JDO.
    There is this Hydrate project (hydrate.sourceforge.net) that I do not know where it fits in still. But it is supposed to do data transformation and mapping between Java objects, XML and database representation.
    Fyi.

Maybe you are looking for

  • IPod is not recognized by one computer

    I got the iPod classic only about a month ago, and I got all the songs onto it fine, but the first time I went to charge it, something weird happened and it's not recognized in iTunes or on my computer. I plugged it into another computer, and it char

  • Apple TV auto sync inoperative since 2.3 update

    I have an Apple TV setup with the following components (most all Apple pieces): iMac G5 with Enet connection to Time Capsule (router) with wireless connection to Apple TV, a laptop PC, and iPod Touch My software versions are: OS X 10.5.5, iTunes 8.0.

  • How to open PDFs at named destinations with MS-Word hyperlinks?

    Hi forum, In MS-Word you can create hyperlinks to open local files, (protocol: file://...) to open websites or (protocol: http://...) to go to intern bookmarks or so. Is it possible to open a local PDF this way at a defined point inside it? For examp

  • End of sequence lost when exporting

    Hello everyone! I have had the problem twice that after working on a sequence for a while it leaves out about ten seconds at the end when I export. The same sequence would have exported fine earlier on. I dont have any In and Out points, although I h

  • Weird Error with JApplet

    My program worked fine as a standalone, but when i tried to convert it to an applet, a pop up box looking for a file in my a: drive comes up and after i close it the applet is terminated. Any ideas on whas goin on?? cheers-