JDBC BATCH Insert in SAP  XI

Hi Everyone
First of all, Thank you all for such a nice contribution on the forum.  I have few questions I have with SAP and JDBC adaptor. 
I was wondering if we could do batch update/insert in XI.
let us say I received 10 different records from IDOC.  I would like to insert all the ten records into a destination oracle table.  I know the way to do would be to do a insert one at a time.  This would involve sending INSERT message every single time.
I was wondering if there is a way to do a batch update. Is it possible to send all the information at one single shot and have it updated.
any suggestions would be highly appreciated.
Regards
Puskar

The way I did this was to use the ability to have 1..n statements in a JDBC Adapter message. So you define the Insert/Update structure with the required access elements, then you can connect the recurring node on the source to the statment node on the target. You may need an intermediate mapping to pull the data cleanly out of the IDOC, depending on what you are retrieving. Make sure you set your statement line in the JDBC message to 1..unbounded occurances. It works great for me... You can even mix and match, having INSERT, UPDATE, EXECUTE, whatever different statements all in one JDBC Adapter call. If doing with stored procedures you need to be careful about how you do your transactions in the stored proc, because of the transaction handling used by JDBC adapter.
I did the multi insert model using a 1-N mapping then looping using a block, it was much messier and results in a lot of messages showing up in the RWB and SXMB_MONI. The all in one approach is much cleaner and executes much faster.

Similar Messages

  • JDBC Batch Updates & PreparedStatement problems (Oracle 8i)

    Hi,
    we're running into problems when trying to use JDBC Batch Updates with PreparedStatement in Oracle8i.
    First of all, Oracle throws a SQLException if one of the statements in the batch fails (e.g. because of a unique constraint violation). As far as I understand, a BatchUpdateException should be thrown?
    The next problem is much worse:
    Consider this table:
    SQL> desc oktest
    ID NOT NULL NUMBER(10)
    VALUE NOT NULL VARCHAR2(20)
    primary key is ID
    When inserting in through batch updates with a PreparedStatement, I can pass 'blah' as a value for ID without getting an exception (Oracle silently converts 'blah' to zero). Only when the offending statement is the last statement in the batch, Oracle throws an exception (again, SQLException instead of BatchUpdateException).
    Any comments/suggestions are appreciated.
    E-mail me if you want to see the code...
    Thanks,
    Oliver
    Oracle version info:
    (Enterprise Edition Release 8.1.6.0.0, JServer Release 8.1.6.0.0, Oracle JDBC driver 8.1.6.0.0 and 8.1.7.0.0 (we're using the 'thin' driver)
    CLASSPATH=/opt/oracle/product/8.1.7/jdbc/lib/classes12.zip:...
    null

    Please refer
    http://www.oracle.com/technology/products/oracle9i/daily/jun07.html

  • JDBC XMLType Insert/Update Performance

    I am writing a backend Java EE application that inserts or updates XML documents into a table backed by XMLType.  I'm using Oracle 11.2.0.3 with associated drivers and XDK, with connections obtained from an oracle.jdbc.poo.OracleDataSource.  Unfortunately, I can't get my application to perform faster than 7 transactions a second, with or without JDBC batching.  I've tried several different table structures; here are the two that have shown the most promise:
    CREATE TABLE mrbook_raw
      id  RAW(16),
      created_date TIMESTAMP,
      last_modified_ts TIMESTAMP,
      bk_typ_cd VARCHAR2(16),
      bk_invt XMLType,
      PRIMARY KEY(id),
      FOREIGN KEY (id) REFERENCES mrbook(id)
    ) XMLTYPE COLUMN bk_invt ELEMENT "http://www.mrbook.com/BookData/Vers1#BK_INVT";
    --Also tried the below...
    CREATE TABLE book_master OF XMLTYPE
    XMLTYPE STORE AS SECUREFILE BINARY XML
    VIRTUAL COLUMNS
      isbn_nbr AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace bk_invt="www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:ISBN_NBR'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) ),
      book_id AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace invtdata="http://www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:BOOK_ID'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) )
    Here is the code that inserts into the first table:
        private static final String INS_MRBOOK_RAW =
                "INSERT INTO MRBOOK_RAW " +
                        "(id, bk_invt, last_modified_ts, created_date) " +
                "VALUES (?, ?, ?, ?)";
        private static final String UPD_MRBOOK_RAW =
                "UPDATE MRBOOK_RAW " +
                "SET " +
                    "bk_invt = ?, " +
                    "last_modified_ts = ? " +
                "WHERE id = ?";
    protected void updateBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            try
                stmt = con.prepareStatement(UPD_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult result = sqlxml.setResult(DOMResult.class);
                result.setNode(record.getExistingInvtData());
                stmt.setSQLXML(1, sqlxml);
                stmt.setTimestamp(2, now);
                stmt.setBytes(3, record.getId());
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
        protected void insertBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            XMLDocument bookDoc = parser.getInvtDataDoc(record.getNewBook());
            try
                stmt = con.prepareStatement(INS_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult domResult = sqlxml.setResult(DOMResult.class);
                domResult.setNode(bookDoc);
                stmt.setBytes(1, record.getId());
                stmt.setSQLXML(2, sqlxml);
                stmt.setTimestamp(3, now);
                stmt.setTimestamp(4, now);
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML object!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
    I've tried every storage method possible; CLOBs, Binary XMLType, and structured storage, but I just cannot get the application to go faster than 7 records/second.
    I understand that this may or may not be an XMLType question, but I don't know where to start.  From everything above, it looks like I should be getting good performance inserting and updating XMLType records; and I do indeed get pretty good performance from retrieval, but not from insert or update.  Does anyone have any suggestions on what I might try or a reference I might look at to start?

    Perhaps a more specific question... should I use PreparedStatements with SQLXML or should I use the OracleXMLSave class?  Are SQLXML types batchable under Oracle?

  • More log writer contention when using JDBC Batch Updates?

    So if I'm already seeing log writer contention when I'm commiting inserts one row at a time.
    Why would I see even more contention of log writer ie. commit waits in Enterprise Manager when I batch these inserts using JDBC updates.
    Today I observed significantly more commit waits when I used JDBC batching vs commit one row at a time.

    Please refer
    http://www.oracle.com/technology/products/oracle9i/daily/jun07.html

  • How to control number of records in batch insert by eclipselink

    Hi,
    We are using eclipselink(2.2) to persist objects and we use following configuration -
    <property name="eclipselink.jdbc.batch-writing" value="Oracle-JDBC" />
    <property name="eclipselink.jdbc.batch-writing.size" value="5" />
    however the number of records inserted is much more than 5( I have seen 5000 records being inserted ). How can we control the number of records inserted once?
    Thanks.

    Binding can be configured using the "eclipselink.jdbc.bind-parameters" property, and is on by default - it should be on for jdbc batch writing.
    Batch writing defaults to 100 statements, so I am not sure why it would include all statements in one batch unless it is not batching at all. If you set the logs to finest or all it should print of the values it is using for each property, and also show the SQL and statments it is executing. Can you turn on logging and post portions of the logs, particularly the part showing the transaction in question (though maybe only 6 lines of consecutive inserts).
    Logging is controlled through the "eclipselink.logging.level" properties.
    Best Regards,
    Chris

  • Batch Insert Using Oracle

    I am having a performance issue with network traffic. Can anyone tell me how to if possible to make batch inserts to a Oracle Database.
    Thanks

    Absolutely, It's called batching.
    There is a code sample in
    ORACLE_HOME/jdbc/demo/samples/oci8/basic-samples/SetExecuteBatch.java
    The feature is not specific to the OCI driver, it works with the KPRB driver within JServer.
    Matthieu

  • Are batch inserts supported in cx_oracle?

    Oracle's JDBC package provides for batch inserting to increase performance. I've used it in writing an ETL tool in Java. I would like to do the same in Python, but I can't find anything that mentions the same batch insert capability in cx_oracle. Any ideas?

    Have you tried http://www.oracle.com/technology/pub/articles/prez-python-queries.html?
    Look for "Many at Once" section.
    Przemek

  • Where would i get Batch Size in SAP BI and what is the cocept of Batch Size

    <heading 4>
    Dear Experts,
                  I have to create a report on batch size adherence i.e. Actual Vs. Standard Batch Size Deviation,but i am unable to find batch size in sap R/3 AFKO & APPO tables and was unable to find it in material master too.
         Please suggest me what is the concept of batch size?where can i get batch size in sap R/3? and in what cube there are chnaces that i will get it on Bi side.
    Regards,
    Beginer
    </heading 4>

    Hi,
    The dswsbobje web application (war file) is mentioned in SAP IK XI 3.1 install guide to explain how to get the SAP authentication option available in Business Objects products such as Live Office, which use web services to log on to BusinessObjects Enterprise.
    The source files for various Business Objects web applications are available in "businessobjects_root\BusinessObjects Enterprise 12.0\java\applications\" folder. Refer to "Deploying the web applications using wdeploy" section in SAP IK XI 3.1 install guide to see how to repackage those web apps and deploy them using wdeploy tool.
    Regards,
    Boris

  • Com.sap.aii.adapter.jdbc.svc and com.sap.aii.adapter.jms.svc don't start

    Hello,
    In order to configure JMS Receiver Adapter to access Websphere Application Server 7.0, I have recently deployed file com.sap.aii.adapter.lib.sca with the following libraries:
    com.sap.aii.adapter.lib_api.jar
    com.ibm.ws.ejb.thinclient_7.0.0.jar
    com.ibm.ws.orb_7.0.0.jar
    com.ibm.ws.sib.client.thin.jms_7.0.0.jar
    com.ibm.ws.runtime.jar   
    javax.j2ee.jms.jar
    The communication channel can reach the queue but when I send a message it fails because services sap.com/com.sap.aii.adapter.jdbc.svc and com.sap.aii.adapter.jms.svc are not started.
    Checking dev_server0 file I found the following error.
    ==============================================================================================
    Service com.sap.aii.adapter.jdbc.svc start ================= ERROR =================
    com.sap.engine.frame.ServiceException: Could not obtain an initial context due to a communication failure. Since no provider
    URL was specified, the default provider URL of "corbaloc:iiop:1.0(at)sapdpi-lpar:2809/NameService" was used.  Make sure that any
    bootstrap address information in the URL is correct and that the target name server is running.  Possible causes other than
    an incorrect bootstrap address or unavailable name server include the network environment and workstation network configurati
    on.
    at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.start(SapAdapterServiceFrameImpl.java:151)
    at com.sap.engine.core.service630.container.ServiceRunner.startFrame(ServiceRunner.java:155)
    at com.sap.engine.core.service630.container.ServiceRunner.startService(ServiceRunner.java:113)
    at com.sap.engine.core.service630.container.ServiceRunner.run(ServiceRunner.java:60)
    at com.sap.engine.frame.core.thread.Task.run(Task.java:73)
    at com.sap.engine.core.thread.impl5.SingleThread.execute(SingleThread.java:162)
    at com.sap.engine.core.thread.impl5.SingleThread.run(SingleThread.java:260)
    Caused by: javax.naming.ServiceUnavailableException: Could not obtain an initial context due to a communication failure. Sinc
    e no provider URL was specified, the default provider URL of "corbaloc:iiop:1.0(at)sapdpi-lpar:2809/NameService" was used.  Make
    sure that any bootstrap address information in the URL is correct and that the target name server is running.  Possible caus
    es other than an incorrect bootstrap address or unavailable name server include the network environment and workstation netwo
    rk configuration. [Root exception is org.omg.CORBA.TRANSIENT: java.net.ConnectException: Connection refused:host=sapdpi-lpar,
    port=2809  vmcid: 0x4942f000  minor code: 3586  completed: No]
    at com.ibm.ws.naming.util.WsnInitCtxFactory.mapInitialReferenceFailure(WsnInitCtxFactory.java:2228)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1414)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:944)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:865)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:545)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:123)
    at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:798)
    at com.ibm.ws.naming.util.WsnInitCtx.rebind(WsnInitCtx.java:242)
    at com.ibm.ws.naming.util.WsnInitCtx.rebind(WsnInitCtx.java:255)
    at javax.naming.InitialContext.rebind(InitialContext.java:367)
    at javax.naming.InitialContext.rebind(InitialContext.java:367)
    at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.start(SapAdapterServiceFrameImpl.java:100)
    ... 6 more
    Caused by: org.omg.CORBA.TRANSIENT: java.net.ConnectException: Connection refused:host=sapdpi-lpar,port=2809  vmcid: 0x4942f0
    00  minor code: 3586  completed: No
    at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:425)
    at com.ibm.ws.orbimpl.transport.WSTransport.getConnection(WSTransport.java:436)
    at com.ibm.CORBA.transport.TransportBase.getConnection(TransportBase.java:187)
    at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:89)
    at com.ibm.rmi.iiop.GIOPImpl.getConnection(GIOPImpl.java:120)
    at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:209)
    at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:307)
    at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:378)
    at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3721)
    at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3256)
    at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3619)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1524)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1389)
    ... 16 more
    Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:522)
    at java.net.Socket.connect(Socket.java:470)
    at java.net.Socket.<init>(Socket.java:367)
    at java.net.Socket.<init>(Socket.java:180)
    at com.ibm.ws.orbimpl.transport.WSTCPTransportConnection.createSocket(WSTCPTransportConnection.java:270)
    at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:354)
    ... 28 more
    Service com.sap.aii.adapter.jms.svc start ================= ERROR =================
    com.sap.engine.frame.ServiceRuntimeException: Could not obtain an initial context due to a communication failure. Since no pr
    ovider URL was specified, the default provider URL of "corbaloc:iiop:1.0(at)sapdpi-lpar:2809/NameService" was used.  Make sure t
    hat any bootstrap address information in the URL is correct and that the target name server is running.  Possible causes othe
    r than an incorrect bootstrap address or unavailable name server include the network environment and workstation network conf
    iguration.
    at com.sap.aii.adapter.jms.core.service.AdapterServiceFrameImpl.bindAdapter(AdapterServiceFrameImpl.java:171)
    at com.sap.aii.adapter.jms.core.service.AdapterServiceFrameImpl.start(AdapterServiceFrameImpl.java:125)
    at com.sap.engine.core.service630.container.ServiceRunner.startFrame(ServiceRunner.java:155)
    at com.sap.engine.core.service630.container.ServiceRunner.startService(ServiceRunner.java:113)
    at com.sap.engine.core.service630.container.ServiceRunner.run(ServiceRunner.java:60)
    at com.sap.engine.frame.core.thread.Task.run(Task.java:73)
    at com.sap.engine.core.thread.impl5.SingleThread.execute(SingleThread.java:162)
    at com.sap.engine.core.thread.impl5.SingleThread.run(SingleThread.java:260)
    Caused by: javax.naming.ServiceUnavailableException: Could not obtain an initial context due to a communication failure. Sinc
    e no provider URL was specified, the default provider URL of "corbaloc:iiop:1.0(at)sapdpi-lpar:2809/NameService" was used.  Make
    sure that any bootstrap address information in the URL is correct and that the target name server is running.  Possible caus
    es other than an incorrect bootstrap address or unavailable name server include the network environment and workstation netwo
    rk configuration. [Root exception is org.omg.CORBA.TRANSIENT: Connection state: State: ABORT (5)  vmcid: 0x4942f000  minor co
    de: 775  completed: No]
    at com.ibm.ws.naming.util.WsnInitCtxFactory.mapInitialReferenceFailure(WsnInitCtxFactory.java:2228)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1414)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:944)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:865)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:545)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:123)
    at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:798)
    at com.ibm.ws.naming.util.WsnInitCtx.rebind(WsnInitCtx.java:242)
    at com.ibm.ws.naming.util.WsnInitCtx.rebind(WsnInitCtx.java:255)
    at javax.naming.InitialContext.rebind(InitialContext.java:367)
    at javax.naming.InitialContext.rebind(InitialContext.java:367)
    at com.sap.aii.adapter.jms.core.service.AdapterServiceFrameImpl.bindAdapter(AdapterServiceFrameImpl.java:163)
    ... 7 more
    Caused by: org.omg.CORBA.TRANSIENT: Connection state: State: ABORT (5)  vmcid: 0x4942f000  minor code: 775  completed: No
    at com.ibm.rmi.iiop.Connection.checkEstablished(Connection.java:3091)
    at com.ibm.rmi.iiop.Connection.send(Connection.java:2145)
    at com.ibm.rmi.iiop.Connection._locate(Connection.java:463)
    at com.ibm.rmi.iiop.Connection.locate(Connection.java:439)
    at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:219)
    at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:307)
    at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:378)
    at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3721)
    at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3256)
    at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3619)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1524)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1389)
    ... 17 more
    ==============================================================================================
    Could anyone tell me why is trying to connect to "corbaloc:iiop:1.0(at)sapdpi-lpar:2809/NameService"? Do I have to configure a default provider URL for SAP PI server? If so, where I configure it? Any help will be appreciated.
    Thank you in advance.
    Roger Allué i Vall

    Hi Roger,
    we also experience the same issue and would be very keen to understand how you resolved this problem.
    Many thanks.
    Dieter

  • How can i get the failed row numbers in batch insertion?

    Afeter execution of batch insert operation into a table, i use OCIAttrGet() to get the error number of insertion, as expected, it returns the correct number. however, when i use OCIParamGet() to get an error handle and then to get the exact failed row numbers , OCIParamGet() returns -2 , means "INVALID_HANDLE". can anyboy tell me why ? how can i get the exact failed rows?
    the snapshot of my code :
    int errNum = 0;
    int nRet = 0;
    nRet = OCIAttrGet((dvoid *)m_pIIOdbc->m_pStmtAll,OCI_HTYPE_STMT,&errNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pIIOdbc->m_pErrHandle);
    if (errNum)
         OCIError* pErrHndl;
         int* pRow_off = new int[errNum];
         for (int i = 0; i < errNum; i++)
         nRet = OCIParamGet(m_pIIOdbc->m_pErrHandle,
    OCI_HTYPE_ERROR, m_pIIOdbc->m_pErrHandle, &pErrHndl, i + 1);
         nRet = OCIAttrGet (pErrHndl, OCI_HTYPE_ERROR, &pRow_off, 0,
         OCI_ATTR_DML_ROW_OFFSET, m_pIIOdbc->m_pErrHandle);
              delete []pRow_off;

    now the code is :
    OCIEnv      *m_pEnvHandle;                    
    OCIError      *m_pErrHandle;                         
    OCIError     *m_pErrHandle2;                    
    OCIServer *m_pSrvHandle;                         
    OCISvcCtx *m_pSvcHandle;                         
    OCIStmt *m_pStmtExec;
    OCIStmt *m_pStmtAll;
    OCIError** m_pErrorHndl;     
    int* m_pRowOff; //the array that will contain the failed row numbers
    int     m_nArrayLength; //length of array in once batch operation
    int m_nErrNum; //error number
    int m_nSucCount; //successful record number
    //initialization
    //m_nArrayLength is a parameter passed in, so i can not tell the exact length of the array, dynamic space allocation is needed
    m_pErrorHndl = new OCIError*[m_nArrayLength];
    m_pRowOff = new int[m_nArrayLength];
    //execution
    OCIStmtExecute(
              m_pSvcHandle,
              m_pStmtAll,
              m_pErrHandle,
              (ub4)m_nArrayLength,
              (ub4)0, (OCISnapshot *)NULL, (OCISnapshot *)NULL,
              OCI_BATCH_ERRORS
    //get successful records number
    m_nSucCount = 0;
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nSucCount,
              0,OCI_ATTR_ROW_COUNT, m_pErrHandle);
    //get error numbers
    m_nErrNum = 0;
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nErrNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pErrHandle2);
    //get failed row numbers into the array
    if (m_nErrNum)
              //get failed row numbers into the array
              for (int i = 0; i < m_nErrNum; i++)
                   //initiallize error handles               OCIHandleAlloc((dvoid*)m_pEnvHandle, (dvoid**)&m_pErrorHndl,
                        OCI_HTYPE_ERROR, (size_t)0, (dvoid**)0);
                   OCIParamGet(m_pErrHandle, OCI_HTYPE_ERROR, m_pErrHandle2, (void**)&m_pErrorHndl[i], i);
                   OCIAttrGet (m_pErrorHndl[i], OCI_HTYPE_ERROR, &m_pRowOff[i], 0,
                                            OCI_ATTR_DML_ROW_OFFSET, m_pErrHandle2);
    now, if batch insert is executed, eg, there are 10 records to be inserted, thus m_nArrayLength is set to be 10. There are 5 records of the 10 have exist in database, so some of insert operations will fail. After execution, m_nErrNum is 5, and i can get the failed row numbers.Everything seems go well.
    However, if batch updata is excuted, eg, 10 records to be updated, m_nArrayLength is set to be 10, and also there are 5 records of the 10 have exist in database. After execution, the OCIStmtExecute() returns 1, m_nErrNum got by
    OCIAttrGet((dvoid *)m_pStmtAll,OCI_HTYPE_STMT,&m_nErrNum,
              0,OCI_ATTR_NUM_DML_ERRORS, m_pErrHandle2)
    is 0, and m_nSucNum is 5. Why?? how can I get the rows that fail? i have to know which rows do not exist in database??

  • Year Specific Batch Numbers in SAP

    Hi All
    Can we have year specific batch numbers in SAP. I would like to define internal batch numbers year wise.
    Every year this numbers have to be reset.
    Pls help in finding a solution.

    use customer exits for batches:
    http://help.sap.com/saphelp_40b/helpdata/en/dc/1d4b6e5733d1118b3f0060b03ca329/content.htm
    yogesh

  • Batch insert running numbered PDFs as background into corresponding numbered PDFs

    My objective: What I want to do is actually simple. I want to replace the pages in a PDF ("the original pdf") with pages from another PDF ("the new pdf") but retain the crop margins of the original pages. Both the new and original PDF has the same number of pages (about 600 pages). The crop margins differ from page to page.
    I can't do so directly as replacing a page replaces the crop margins of the original page with the crop margins of the new page. Neither is there an option to export and import crop margins.
    The workaround I am using is do insert the new page into the original page as a background (with the "scale relative to target page" option unchecked), and deleting the page (it has not been OCRed, so it is just an image) object, revealing the underlying inserted page. This works, but only for 1 page, because I can only select, in the insert background dialog box, one page out of the new PDF to insert as background into the original PDF.
    What I want to do instead is to insert as background corresponding pages of the new PDF into the pages of the original PDF, i.e. p 1 to p1, p2 to p2.
    To try to get around this, I extracted all the pages in the new and original PDF as separate files. My idea is to create an action that will batch insert, the single paged PDFs in one folder as background into the corresponding single paged PDFs in another folder, i.e. insert 1.pdf in Folder A as background for 1.pdf in Folder B, 2.pdf in Folder A as background for 2.pdf in Folder B and on.
    This is where I am stuck. How can I define an action to do that? Or can this be done by script? I have no experience with scripts.
    Help!
    Many thanks,
    Jay

    Change the Save command to "Save to local folder" (by clicking the arrow icon next to it), and then select where you want to save the edited files.

  • Batch insert from object variable

    Any way to do this excluding the foreach loop container?  I have millions of rows and if it goes through them 1 by 1 it will take hours maybe days.  How can you do a batch insert from an object variable without putting the sql task inside
    a foreach loop container?
    thanks,
    Mike
    Mike

    I know how to use the dataflow task but it will not work with what I am trying to do as far as I know.  The script I am running is against a netezza box that creates temp tables and then returns a data set that I store in an object variable. 
    I then want to take the data from that object variable and batch insert it into a table.  The only way I can see this being done is by looping through the record set in a foreach loop while mapping the fields to variables and inserting records one
    at a time like I am doing in the screenshot above.  This takes way to long to do.  I am trying to figure out a way to do a batch insert using the data in this object variable.  Is this possible?  I am using SSIS Version
    10.50.1600.1
    thanks,
    Mike
    Hi Mike,
    Provide more details why you cannot use the data flow task for the processing.
    Let me repeat . Loading millions of records in object variable will not work. 
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • How are JDBC batch updates implemented by Oracle?

    When you're looking to reduce commits you typically think of JDBC batch updates.
    I'm just wondering how are these implemented by Oracle and is there ever gains to be had to reducing commits in an Oracle specific way like say using VARRAYs with procedures?

    Please refer
    http://www.oracle.com/technology/products/oracle9i/daily/jun07.html

  • Any jdbc examples inserting XML doc

    Newbie to xmldb/jdbc/java
    I'm looking for some sample java code that uses jdbc to insert xml docs into the 10g xml db.
    Also looking for sample code that does xquery using JDBC on 10g xmldb.
    (using eclipse on windows)
    any help appreciated

    Does this help, assume that you have an instance of
    public XMLType makeXMLType(OracleConnection conn,Document xmlDocument)
    throws NamingException
    try {
    XMLType xml = null;
    if (xmlDocument != null)
    xml = XMLType.createXML(conn,xmlDocument);
    return xml;
    catch (SQLException sqle)
    NamingException ne = new NamingException(SQLCache.UNEXPECTED_SQL_EXCEPTION);
    ne.setRootCause(sqle);
    throw ne;
    You can then bind the XMLType to an insert statement using setObject.

Maybe you are looking for