JDBC Rollback

Hi Gurus!
I have two doubt:
I have a process that with a Sender JDBC I do SELECTs and UPDATE to a DATABASE. Then when I select a list of entries, these entries are flagged to not be processed again.
1. If there is a problem when I process these entries, by example an error in a Message Mapping, could the changes on the database be rolledback? If could  be, is done by XI in a standard way.
2. I have the same doubt to Receiver JDBC, I update an entry on a table, this call to the JDBC is on a BPM, when we get the response the BPM continues running, if there is an error on the BPM, could this entry be rolled back?
Thanks and regards,
Manuel.

Hi Manuel,
Please take a look at this blogs and threads:
/people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
/people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
Re: JDBC Sender - Different number of records selected and updated.
Re: JDBC sender Adapter consistency and Transaction level - URGENT
Regards,
---Satish

Similar Messages

  • MDB and Database - Listener port stops working

    Hi,
    I have created an MDB which does the following when a message is received from the queue.
    1. Store message in database
    2. do some processing
    At step 1, if there is any issue with the database connection (e.g. database is not available etc), I rollback transaction. My idea is to leave the message on queue for now and retry it again after some time unless the database is back again. "Maximum retries" of the listener port is set to N but since there is no retry interval available, all N retries are done in a flash and my listener port stops working. I cannot use backout mechanism as I have to wait for the database to be back again. What are my options?

    usmanchaudhry wrote:
    Hi,
    I have created an MDB which does the following when a message is received from the queue.
    1. Store message in database
    2. do some processing
    At step 1, if there is any issue with the database connection (e.g. database is not available etc), I rollback transaction. My idea is to leave the message on queue for now and retry it again after some time unless the database is back again. "Maximum retries" of the listener port is set to N but since there is no retry interval available, all N retries are done in a flash and my listener port stops working. I cannot use backout mechanism as I have to wait for the database to be back again. What are my options?i believe you need an XA driver and a transaction manager, for starters.
    a simple JDBC rollback won't do it.
    which app server are you using?
    which jms provider?
    %

  • Setting packetSize given in JDBCDriver.

    I am using, Java, Jboss, Hibernate, SqlServer 2008 R2, getting following exception
    WARNING [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 TDS header contained invalid packet length:12590; packet size:8000
    SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-26-thread-7) ConnectionID:4 got unexpected value in TDS response at offset:7992
    ERROR [STDERR] (pool-25-thread-2) Exception in thread "pool-25-thread-2"
    ERROR [STDERR] (pool-25-thread-2) org.hibernate.TransactionException: JDBC rollback failed
    [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:204)
    [STDERR] (pool-25-thread-2) at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.rollbackIfNecessary(HibernateLocalTxnInterceptor.java:149)
    [STDERR] (pool-25-thread-2) at com.wideplay.warp.persist.hibernate.HibernateLocalTxnInterceptor.invoke(HibernateLocalTxnInterceptor.java:72)
    [STDERR] (pool-25-thread-2) at com.softpak.marserm.engine.library.impl.JobReportStatusUtil.updateReportStatus(Unknown Source)
    [STDERR] (pool-25-thread-2) at com.softpak.marserm.engine.library.impl.ExecutableJob.run(Unknown Source)
    [STDERR] (pool-25-thread-2) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    [STDERR] (pool-25-thread-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    [STDERR] (pool-25-thread-2) at java.lang.Thread.run(Thread.java:662)
    [STDERR] (pool-25-thread-2) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
    [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170)
    [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:304)
    ERROR [STDERR] (pool-25-thread-2) at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:1655)
    ERROR [STDERR] (pool-25-thread-2) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:697)
    ERROR [STDERR] (pool-25-thread-2) at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:500)
    ERROR [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217)
    ERROR [STDERR] (pool-25-thread-2) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196)
    ERROR [STDERR] (pool-25-thread-2) ... 7 more
    I need to increase packetSize given in JDBCDriver (sqljdbc4), How can I do this?
    I tried many things including defining <packetSize>32767</packetSize> in ds.xml but no use, getting this exception now
    SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN] (pool-27-thread-7) ConnectionID:1: FetchBufferTokenHandler: Encountered unexpected unknown token (0x30)
    SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-27-thread-7) ConnectionID:1 got unexpected value in TDS response at offset:7282
    SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN] (pool-27-thread-7) ConnectionID:1: getNextResult: Encountered unexpected unknown token (0x30)
    SEVERE [com.microsoft.sqlserver.jdbc.internals.TDS.Reader] (pool-27-thread-7) ConnectionID:1 got unexpected value in TDS response at offset:7282
    Edited by: 1007286 on 22-May-2013 00:23

    This isn't the place to ask questions about Microsoft products. I would try to find a manual for the JDBC driver on the Microsoft website if I were you. But I'm a curious chap so I did a quick Google for "sqlserver jdbc packetsize" and turned this up as the first result:
    http://msdn.microsoft.com/en-us/library/ms378988%28v=sql.90%29.aspx
    This documentation lists the property exactly as you say. However one (old) source of information is not enough, I check more results.
    http://docs.oracle.com/cd/E13157_01/wlevs/docs30/jdbc_drivers/mssqlserver.html
    This documentation has an interesting tidbit:
    "NOTE: If SSL is enabled, the driver communicates with database protocol packets set by the server’s default packet size. Any value set by the PacketSize property is ignored. "
    I would read more documentation if I were you.

  • Idle time Closed Connection

    Hi,
    The following is the exception that i get when i use hibernate 3.0 to connect to Oracle 10G using the ojdbc14.jar.
    i get this error when i run my eclipse plugin based application on windows vista. This happens when i keep the system idle for prolonged hours apprx 8 hours or more. But the same is not reproduced when i keep it idle on the windows xp system.
    The Oracle server is present on another system which is a windows XP system but not on the same system where iam running the appliation.
    So i need to know whether it is the Vista problem or the hibernate problem.
    org.hibernate.TransactionException: JDBC rollback failed
    at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:170)
    at <exceptions trace from the code>
    Caused by: java.sql.SQLException: Closed Connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    at oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:1439)
    at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:183)
    at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:162)
    ... 9 more
    Thanks
    Jagadish Suri

    I think you need to do a firmware upgrade on your Router. Go to website linksysbycisco.com/downloads.........insert model no of your router in serach tab......select proper version of your router........download the firmware file......save that file on desktop..
    Follow these steps to upgrade the firmware on the device : -
    Open an Internet Explorer browser page on a computer hard wired to the router...
    In the address bar type - 192.168.1.1...Leave the Username blank & in Password use admin in lower case...
    Click on the 'Administration' tab- Then click on the 'Firmware Upgrade' sub tab- Here click on 'Browse' and browse the .bin firmware file and click on "Upgrade"...
    Wait for few seconds until it shows that "Upgrade is successful"  After the firmware upgrade, click on "Reboot" and you will be returned back to the same page OR it will say "Page cannot be displayed".
    Now reset your router :
    Press and hold the reset button for 30 seconds...Release the reset button...Unplug the power cable from your router, wait for 30 seconds and re-connect the power cable...Now re-configure your router...

  • JDBC  Transaction is no longer active - status: 'Marked rollback'

    I'm getting the folowing issue, we are not seeing this issue if we recycle the WLS
    Using WLS V10.3.3
    Can any one suggest on this issue, how to reslove this
    85417.772: [Full GC [PSYoungGen: 117504K->0K(234880K)] [PSOldGen: 662564K->665699K(700416K)] 780068K->665699K(935296K) [PSPermGen: 133284K->132438K(225280K)], 30.2876423 secs] [Times: user=31.23 sys=0.68, real=30.32 secs]
    java.sql.SQLException: The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 39 seconds
    BEA1-600C65F8B23E363DFDF0]'. No further JDBC access is allowed within this transaction.
    at weblogic.jdbc.wrapper.JTSConnection.checkIfRolledBack(JTSConnection.java:193)
    at weblogic.jdbc.wrapper.JTSConnection.checkConnection(JTSConnection.java:209)
    at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:99)
    at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
    at com.vzw.pos.cmw.ejb.service.UserProfileService.getNewUserId(Unknown Source)
    at com.vzw.pos.cmw.ejb.utils.CMWEjbUtil.createUserProfileVO(Unknown Source)
    at com.vzw.pos.cmw.ejb.utils.CMWEjbUtil.createRosterVO(Unknown Source)
    at com.vzw.pos.cmw.ejb.service.AdministrationBean.getRostersByUserId(Unknown Source)
    at com.vzw.pos.cmw.ejb.service.Administration_ujnwz8_ELOImpl.__WL_invoke(Unknown Source)
    at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
    at com.vzw.pos.cmw.ejb.service.Administration_ujnwz8_ELOImpl.getRostersByUserId(Unknown Source)
    at com.vzw.pos.cmw.action.CMWTopFrameAction.setUserRoleInSession(Unknown Source)
    at com.vzw.pos.cmw.action.CMWTopFrameAction.changeLocation(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor190.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.vzw.pos.cmw.filters.CMWFilter.doFilter(Unknown Source)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3710)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3676)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2272)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2178)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    <Aug 23, 2013 10:41:53 AM EDT> <Warning> <Socket> <BEA-000450> <Socket 298 internal data record unavailable (probable closure due idle timeout), event received -32>
    <Aug 23, 2013 10:41:53 AM EDT> <Warning> <Socket> <BEA-000450> <Socket 286 internal data record unavailable (probable closure due idle timeout), event received -32>
    <Aug 23, 2013 10:41:56 AM EDT> <Warning> <Socket> <BEA-000450> <Socket 299 internal data record unavailable (probable closure due idle timeout), event received -32>
    <Aug 23, 2013 10:42:51 AM EDT> <Warning> <Socket> <BEA-000450> <Socket 286 internal data record unavailable (probable closure due idle timeout), event received -32>

    Here is DS configuration
    Initial Capacity:                  75
    Maximum Capacity:                  75
    Capacity Increment:                    1
    Seconds to trust an idle pool connection:     10
    Shrink Frequency:                    900
    Enable Connection Leak Profiling:          False
    Enable Connection Profiling:               False
    Test Frequency:                         120 seconds
    Test Connections on Reserve:               True
    Connection Reserve Timeout:               10 seconds
    Connection Creation Retry Frequency:         1
    Inactive Connection Timeout:               60 second
    Maximum Waiting for Connection:               2147483647
    Statment Cache Type:     LRU
    Statment Cache Size:     10
    Connection Creation Relay Frequency:      1
    Remove Infected Connections Enabled:      True
    Wrap Data types:     True
    Ignore In-use connections:     True

  • RECEIVER JDBC ADAPTER----ROLLBACK IN XI

    Hi Gurus,
    I have a scenario with the receiver as JDBC adapter.If there is any error in updating to Database during the interface flow,how do Rollback occurs in XI???
    Please help......
    Regards,
    Sriparna

    Hi Sripam1,
    select SQL statement 'batch mode' ,
    i.e,
    see
    8. Defining Parameters in Advanced Mode
       6. If you want to collect SQL statements in a batch, select Batch Mode.
    of the SAP online help
    [Configuring the Receiver JDBC Adapter|http://help.sap.com/saphelp_nwpi711/helpdata/en/48/465581929734d9e10000000a42189d/content.htm]
    Also ensure that 'Database Auto-Commit-Enabled (No Transaction Handling)' is not enabled.
    Regards
      Kenny

  • Cannot commit or rollback  a JDBC Connection from CAF project

    Hi Everybody,
    I'm working in CE 7.10. I have a CAF Project that gets a JDBC connection from a Custom Datasource to an external Database.
    Here is the code:
      try
        Context ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup("jdbc/MYDATABASE");               
        con = ds.getConnection();
        con.setAutoCommit(false);
        Statement statement = con.createStatement();
        String updateStatement = "UPDATE TABLE...";
        statement.executeUpdate(updateStatement);
        con.commit();
        catch(SQLException sqle){
             con.rollback();
    I got the following exception on line "con.setAutoCommit(false);":  --> "Cannot begin JDBC transaction from this connection of "MYDATABASE" DataSource. JTA transaction has already started."
    and the following on line "con.commit() / con.rollback()" : --> "Cannot commit JDBC transaction from this connection of "MYDATABASE" DataSource. This resource participates in a JTA transaction."
    If I run the same code from a webDynpro or a J2EE project it works ok, but not from a CAF Application Service. I tried to do it in a simple Class in the CAF Project and call this clas from the Application service, but I get the same error.
    Any Ideas??
    Thanks a lot!
    Regards.

    Solved with   "SessionContext.setRollbackOnly()" instruccion.
    Regards.

  • JDBC adapter Commit/Rollback

    Hi Guys, I got a question regarding JDBC adapter auto commit. Hopefully you guys can help me :). Until now, when my XI calling a storedprocedure in ORACLE using JDBC adapter, it will automatically commit the calling. When i see my configuration for the JDBC adapter receiver, the checkbox for Enable Autocommit is thicked. My question is, is there anyway that we handle the commit or rollback ourself. How we can handle that? Is it from the BPM or just from the Configuration.
    Thank you very much in advance for all replies, advices and answer. Cheers guys..

    Hi
    Try this out
    You can programmatically set auto commit to true as in follows
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    // Connect to the database
    // You can put a database hostname after the @ sign in the connection URL.
    Connection conn =
          DriverManager.getConnection ("jdbc:oracle:oci:@", "scott", "tiger");
    // It's faster when auto commit is off
    <b>conn.setAutoCommit (true); </b>
    // Create a Statement
    Statement stmt = conn.createStatement ();
    regards
    krishna

  • Weblogic 10.0, JTA -JDBC ejb rollback problem

    Hi,
    I have one statless-session bean, with bean managed transaction.
    ejbmethod()
    utx=getUserTransaction();
    try{
    utx.begin();
    method1(); //in this i am updating few table in DB -DB connection is taken in the same method and closed there
    method2(); // calling a stored procedure to do smthing etc
    method3(); //update smthing else
    utx.commit();
    }catch()
    utx.rollback()
    the rollback does not happen properly.
    The code is not wrong, no nested transaction, db changes does not get rolled back.
    My question is , what is the relation between JTA configuration and DB Connection pool?
    Is there any specific configuration in weblogic fot JTA?
    How to configure the JTA log in weblogic 10?

    For guaranteed transaction atomicity in general, if your application updates multiple transactional resources, an XA-enabled version of the JDBC driver is required to participate in such a global 2PC transaction. If you are absolutely sure that the datasource in question is the only resource accessed in the transaction, then you can mark this datasource as 1PC in the WLS console. Even, if you application enlists multiple resources in a transaction, using the [LLR optimization|http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jta/llr.html] you are still able to use exactly one non-XA resource that must be a LLR datasourse without losing the atomicty guarantee. In order to use LLR, you have to make sure that you don't cache a the LLR datasource connection beyond transaction boundaries, i.e., you need to obtain a new connection from the LLR datasource for every transaction. See http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jdbc_admin/jdbc_datasources.html for more details.
    Edited by: Gera Shegalov on Mar 17, 2009 4:44 PM

  • Errors using weblogic sql driver: "No JDBC connection can be made because the transaction state is marked rollback"

    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
         at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)
         at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
         at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
         at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

    Joseph Weinstein <[email protected]> wrote:
    >
    >
    YuanHui Liu wrote:
    Joe,
    We got the exact same error message. The error came after we got theJDBC connection,
    and trying to create statement off it.
    It occurs intermitently when we are running another standalone JAVAapp to do
    some end of day work, which results in the DB Server being very busy(90+%CPU
    usage) for about 5 minutes. We see a surge of requests to the WLSJDBC Connection
    pool. This would sometimes result in all our subsequent DB requeststo fail and
    lead to a crash.
    We are using WLS6.0SP1. I do not think there's a 30 seconds wait leadingto a
    connection timeout that caused this(rather it is the end effect).
    Can you give us a more detailed explanation? Is there a miscommunicationbetween
    our DB(Sybase12) and WLS?Hi. It looks to you like it's after you get the connection, but really
    it's when the server is
    gettng the pool connection. For performance/synchronization reasons we
    do a clever
    delay: When your code asks for a pool connection we quickly give you
    the pool wrapper,
    but we delay actually reserving the real underlying DBMS connection until
    your first
    real need for a connection, at your first JDBC call, such as createStatement()
    etc.
    It is while waiting for a pool connection long enough for the transaction
    coordinator
    to have timed you out before you ever get a chance. It's nothing to do
    with the
    DBMS or even JDBC, I believe. I think the weblogic server either has
    too few execute-threads
    and/or too few CPU cycles to do the work load.
    Okay, so there's a lazy initialization of the connection.
    From reading our log I believe our failur is immediate rather
    than waiting for 30+ seconds(the default setting) from the DB,
    the timeout occurred later as a result. At the time either because the DB Server
    is very busy.
    Since we are running WLS6.0 we have only one connection pool,
    we have defined a max of 150 threads in the pool. While this
    is happening the DB Server is being pinned by an overnight job,
    but the WLS Server is not busy at all. The DB and WLS resides
    on different physical boxes.
    We also have a thread dump from the WLS console when we rebooted the server, it
    showed that we are hanging on to the thread & jdbc
    connections after these exceptions has occurred instead of releasing them, note
    "16083"(~4.5 hours) seconds has passed:
    142 116222 Retry rollback request for tx: 'transaction=(IdHash=2963855,Name =
    [EJB UserManagerBeanImpl.signalICUserServletHeartBeat()],Xid=30643:8f3838f3709bf53d,Status=Rolling
    Back. [Reason = Unknown],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since
    begin=16083,seconds left=10,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=server),SCInfo[server]=(state=active),properties=({weblogic.jdbc=t3://159.55.158.25:8005,
    weblogic.transaction.name=[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()]}))'
    Scheduled Trigger
    So I would argue this problem actually chewed up resources on the WLS server.
    -Yuanhui Liu
    >>
    >>
    Thanks.
    -YuanHui Liu
    Joseph Weinstein <[email protected]> wrote:
    lixin wrote:
    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
    at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)Hi. This sounds like a JVM thread starvation issue, and/or a server
    load
    issue. What is
    happening is that the transaction is started, and times out beforethe
    SSB even gets to
    the first JDBC work. I would first verify that the customer is using
    the very latest JVM
    available for the machine.
    Joe Weinstein
    at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
    at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

  • Problem with JDBC CONNX (make Rollback)

    When we work with tables in BD since Oracle ADF through this JDBC ConnX operate correctly, except when done in a transaction rollback, which produces the following error performance: "Statement not active."
    To determinate where the error occurred, we have made the following evidence:
    - 1st Test (ADF-BC):
    We create a project a ADF-BC with a single entity and a single view object based on that entity.
    We introduce the View object in an Application Module.
    We execute test Application Module, we have modifying a field of view of a row and then we execute Rollback.
    In this first case, It produce an exception: "Statement not active."
    It occurs the same exception when not change anything, and we do Rollback.
    - 2nd Test (with Java J2EE): You make a Java class that does all the above, but with our Java code:
    Open a connection with the BD Oracle through ConnX.
    We changed the same field in the same row of the same table in the 1st Test, and then we do the Rollback.
    In this second case, the RollBack has functioning properly.
    Close the connection.
    The conclusion of the evidence, is that when we do the 1st Test the RollBack, this Statement is not Active between ADF-BC and JDBC ConnX, but we unknown by that this staments has been closed, and why the project ADF-BC need it.
    We have actived to the project ADF-BC the bigger log that we know: Project Properties> Run-Debug> Edit> Options Java-Djbo.debugoutput = console. And we not finish to detect where the error occurs.
    We need to see the code that generates ADF-BC for this test and thus be able to trace what is running ADF-BC to the lowest level, to identify the problem and to execute a RollBack correctly.
    This is the error Trace:
    [350] EntityCache close prepared statement
    [351] TcomcestapruebaView notify ROLLBACK ...
    [352] Clearing VO cache for TcomcestapruebaView
    [353] Clear QueryCollection in cache for VO TcomcestapruebaView
    [354] Clearing EO cache for es.ramondin.model.views.Tcomcestaprueba
    [355] Clearing VO cache for TcomcestapruebaView
    [356] Clear QueryCollection in cache for VO TcomcestapruebaView
    [357] Column count: 19
    [358] ViewObject: TcomcestapruebaView Reusing defined prepared Statement
    [359] Bind params for ViewObject: TcomcestapruebaView
    [360] ViewObject: TcomcestapruebaView close single-use prepared statements
    [361] QueryCollection.executeQuery failed...
    [362] java.sql.SQLException: STATEMENT NOT ACTIVE
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.checkContext(TCJdbcStatement.java:1038)
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.statementCmd(TCJdbcStatement.java:674)
         at com.Connx.jdbc.TCJdbc.TCJdbcPreparedStatement.executeQuery(TCJdbcPreparedStatement.java:78)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:687)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2657)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2634)
         at oracle.jbo.server.ViewRowSetIteratorImpl.first(ViewRowSetIteratorImpl.java:1474)
         at oracle.jbo.server.ViewRowSetImpl.first(ViewRowSetImpl.java:2827)
         at oracle.jbo.server.ViewObjectImpl.first(ViewObjectImpl.java:5724)
         at oracle.jbo.jbotester.ResultWindow.refreshForm(ResultWindow.java:324)
         at oracle.jbo.jbotester.ResultWindow.refreshAll(ResultWindow.java:282)
         at oracle.jbo.jbotester.MainFrame$RollbackAction.doAction(MainFrame.java:903)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:81)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    [363] TcomcestapruebaView>#q old SQLStmtBufLen: 800, actual=770, storing=800
    [364] SELECT Tcomcestaprueba.USUARIO, Tcomcestaprueba.FECHAHORA, Tcomcestaprueba.PROCLI, Tcomcestaprueba.ORDCLI, Tcomcestaprueba.REFPED, Tcomcestaprueba.FECPED, Tcomcestaprueba.SELECCION_MATERIAL, Tcomcestaprueba.SELECCION_ANOS, Tcomcestaprueba.SELECCION_DESTINO, Tcomcestaprueba.SELECCION_ESPESOR, Tcomcestaprueba.SELECCION_COLOR_COSTADO, Tcomcestaprueba.SELECCION_MUESTRAS, Tcomcestaprueba.SELECCION_REFCLIENTE, Tcomcestaprueba.SELECCION_COMPLEX, Tcomcestaprueba.METIDO_CLIENTE, Tcomcestaprueba.AGRUPA_LINEAS, Tcomcestaprueba.SELECCIONADO, Tcomcestaprueba.FACTORIA, Tcomcestaprueba.FECREC FROM DBO.TCOMCESTAPEDIDOS Tcomcestaprueba
    [365] ##### QueryCollection.finl oracle.jbo.Key[]
    [366] oracle.jbo.SQLStmtException: JBO-27122: Error SQL durante la preparación de la sentencia. Sentencia: SELECT Tcomcestaprueba.USUARIO, Tcomcestaprueba.FECHAHORA, Tcomcestaprueba.PROCLI, Tcomcestaprueba.ORDCLI, Tcomcestaprueba.REFPED, Tcomcestaprueba.FECPED, Tcomcestaprueba.SELECCION_MATERIAL, Tcomcestaprueba.SELECCION_ANOS, Tcomcestaprueba.SELECCION_DESTINO, Tcomcestaprueba.SELECCION_ESPESOR, Tcomcestaprueba.SELECCION_COLOR_COSTADO, Tcomcestaprueba.SELECCION_MUESTRAS, Tcomcestaprueba.SELECCION_REFCLIENTE, Tcomcestaprueba.SELECCION_COMPLEX, Tcomcestaprueba.METIDO_CLIENTE, Tcomcestaprueba.AGRUPA_LINEAS, Tcomcestaprueba.SELECCIONADO, Tcomcestaprueba.FACTORIA, Tcomcestaprueba.FECREC FROM DBO.TCOMCESTAPEDIDOS Tcomcestaprueba
         at oracle.jbo.server.BaseSQLBuilderImpl.processException(BaseSQLBuilderImpl.java:3383)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:958)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:687)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2657)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2634)
         at oracle.jbo.server.ViewRowSetIteratorImpl.first(ViewRowSetIteratorImpl.java:1474)
         at oracle.jbo.server.ViewRowSetImpl.first(ViewRowSetImpl.java:2827)
         at oracle.jbo.server.ViewObjectImpl.first(ViewObjectImpl.java:5724)
         at oracle.jbo.jbotester.ResultWindow.refreshForm(ResultWindow.java:324)
         at oracle.jbo.jbotester.ResultWindow.refreshAll(ResultWindow.java:282)
         at oracle.jbo.jbotester.MainFrame$RollbackAction.doAction(MainFrame.java:903)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:81)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    ## Detail 0 ##
    java.sql.SQLException: STATEMENT NOT ACTIVE
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.checkContext(TCJdbcStatement.java:1038)
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.statementCmd(TCJdbcStatement.java:674)
         at com.Connx.jdbc.TCJdbc.TCJdbcPreparedStatement.executeQuery(TCJdbcPreparedStatement.java:78)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:687)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2657)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2634)
         at oracle.jbo.server.ViewRowSetIteratorImpl.first(ViewRowSetIteratorImpl.java:1474)
         at oracle.jbo.server.ViewRowSetImpl.first(ViewRowSetImpl.java:2827)
         at oracle.jbo.server.ViewObjectImpl.first(ViewObjectImpl.java:5724)
         at oracle.jbo.jbotester.ResultWindow.refreshForm(ResultWindow.java:324)
         at oracle.jbo.jbotester.ResultWindow.refreshAll(ResultWindow.java:282)
         at oracle.jbo.jbotester.MainFrame$RollbackAction.doAction(MainFrame.java:903)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:81)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Hello Frank,
    We use:
    Sql Flavor: SQL92
    Type Map: Java
    We've done the test with DataDirect JDBC for Oracle and it works fine. It seems that the
    error happens in the function "bindParametersForCollection" which calls the
    other two ones you sent us. We think it's in the
    freeStatament call, but we'd like to review it.
    Thanks in advance.
    This is a new trace more complete:
    [292] ViewObjectImpl.afterRollback(8848) TcomcestapedidosView1 notify ROLLBACK ...
    [293] ViewObjectImpl.doClearCache(8827) Clearing VO cache for TcomcestapedidosView1
    [294] ViewObjectImpl.clearQueryCollectionCache(4640) Clear QueryCollection in cache for VO TcomcestapedidosView1
    [295] DBTransactionImpl.clearEntityCacheInternal(3846) Clearing EO cache for model.Tcomcestapedidos
    [296] ViewObjectImpl.doClearCache(8827) Clearing VO cache for TcomcestapedidosView1
    [297] ViewObjectImpl.clearQueryCollectionCache(4640) Clear QueryCollection in cache for VO TcomcestapedidosView1
    [298] QueryCollection.createColumnList(2527) Column count: 19
    [299] ViewObjectImpl.getPreparedStatement(8179) ViewObject: TcomcestapedidosView1 Reusing defined prepared Statement
    [300] ViewObjectImpl.bindParametersForCollection(13751) Bind params for ViewObject: TcomcestapedidosView1
    [301] ViewObjectImpl.freeStatement(8291) ViewObject: TcomcestapedidosView1 close single-use prepared statements
    [302] QueryCollection.buildResultSet(954) QueryCollection.executeQuery failed...
    [303] Diagnostic.printStackTrace(410) java.sql.SQLException: STATEMENT NOT ACTIVE
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.checkContext(TCJdbcStatement.java:1038)
         at com.Connx.jdbc.TCJdbc.TCJdbcStatement.statementCmd(TCJdbcStatement.java:674)
         at com.Connx.jdbc.TCJdbc.TCJdbcPreparedStatement.executeQuery(TCJdbcPreparedStatement.java:78)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)

  • JDBC-BC rollback

    I am trying to test a database rollback in open-esb using the
    jdbc-bc and two insert statements but its not working.
    I'm hoping someone can tell me what I'm missing.
    I have a bpel that calls two insert statements. The
    second will cause a pk violation. The problem is that
    when the second insert fails the first insert is not
    rolled back.
    I set Transaction="XATransaction" in the jdbc:input
    tag and set up JDBC to use the the XADataSource.
    Here's the insert stack trace
    javax.jbi.messaging.MessagingException: Error occured
    while executing SQL.insert into [Removed by me]
         at
    com.sun.jbi.jdbcbc.OutboundMessageProcessor.executeOutboundSQL(OutboundMessageProcessor.java:507)
         at
    com.sun.jbi.jdbcbc.OutboundMessageProcessor.processInOut(OutboundMessageProcessor.java:311)
         at
    com.sun.jbi.jdbcbc.OutboundMessageProcessor.execute(OutboundMessageProcessor.java:204)
         at
    com.sun.jbi.jdbcbc.OutboundMessageProcessor.run(OutboundMessageProcessor.java:128)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: ORA-00001: unique
    constraint (MERC.SYS_C006974) violated
         at
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    Thanks

    Hmmm...this is odd. We certainly fixed some issues surrounding this most recently. If you look at some of the threads on [email protected], we have resolved this.
    However, before just saying to "try the latest". Maybe we can get your sample scenario and try it out with the latest DB BC runtime and tooling to make sure that it's not some other issue.
    Alex

  • Rollback of JDBC Statement on error - Stored Procedure

    Hi All,
    We are using the JBDC receiver adapter for inserting the record and for that we are using the Strored Procedure and we have N number of the records for insertion in a single mapping so, we have given the occurence of the Statement 1 : unbounded as, multiple statement will be executed so, my query is if one of statement fails because of some error(Mapping error or data error) what will happen to the statement which are already executed, do they rollback? or it is not possible in case of stored procedure?
    Regards,
    Gaurav

    Hi,
    This is one of the solution but i guess there is one more issue, if we have 10 statements and third statement shows error and Stored Exception exception branch is able to catch then it will rollback the previous statement but can we able to restrict another 7 pending statement for execution or not?
    Regards,
    Gaurav

  • Problem with RollBack in  Oracle Batching

    Hi all,
    This is Adhil. I am facing a problem with Oracle Batching in java.
    I am using java 1.5 and Oracle 10 g.
    I have a below standalone code to test the Oracle Batching (Assume that i have the 2 tables with zero records ).
    with the batch size set as 10, I am trying add 2 records in each table.
    Now I rise divideByZero error exception manually and trying to rollback the connection in catch statement . But couldn't rollback the connection. I see the 2 records added in both of my tables.
    The same code when i set the batchsize 2 and trying to insert 10 records ,I could rollback and no rows get inserted.
    Since I am going to get the no of insert from user in runtime , my rollback may fail in any combinations as in my first case(with batch size 10 and if the no of insert is 2).
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.jdbc.*;
    public class BatchTest{
         public static void main(String args[]) throws Exception{
              Connection conn = null;
              conn = new BatchTest().createConnection();
              new BatchTest().insertdata(conn);
         public Connection createConnection() throws Exception{
                   Properties props =new Properties();
                   props.load(ClassLoader.getSystemResourceAsStream("connection.properties"));
                   String connectionString = (String)props.get("connection");
                   String username = (String)props.get("username");
                   String password = (String)props.get("password");
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   Connection connection = DriverManager.getConnection(connectionString, username, password);
                   return connection;
         public void insertdata(Connection dbConnection){
              PreparedStatement psCnt =null;
              PreparedStatement psImp =null;
              try{
              dbConnection.setAutoCommit(false);
              psCnt = dbConnection.prepareStatement("insert into CHKCNT values (?,?)");
              psImp = dbConnection.prepareStatement("insert into CHKIMP values (?,?)");
              ((OraclePreparedStatement)psCnt).setExecuteBatch (10);
              ((OraclePreparedStatement)psImp).setExecuteBatch (10);
              int x=0;
              for(int i=1;i<=2;i++){
                        psCnt.setInt(1,i);
                        psCnt.setString(2,"Jack");
                        psImp.setInt(1,i);
                        psImp.setString(2,"John");
                        psImp.executeUpdate();
                        psCnt.executeUpdate();
              if(true) x=10/0;
              dbConnection.commit();
              }catch(Exception e){
                   try{
                   dbConnection.rollback();
                   dbConnection.close();
                   }catch(Exception ex){
                   e.printStackTrace();
              }finally{
                   try{
                        psCnt.close();
                   }catch(Exception ee){
                   ee.printStackTrace();
    Can anyone suggest me a way to make my rollback work.
    Thanks in advance.
    -adhil.J

    Hi all,
    This is Adhil. I am facing a problem with Oracle Batching in java.
    I am using java 1.5 and Oracle 10 g.
    I have a below standalone code to test the Oracle Batching (Assume that i have the 2 tables with zero records ).
    with the batch size set as 10, I am trying add 2 records in each table.
    Now I rise divideByZero error exception manually and trying to rollback the connection in catch statement . But couldn't rollback the connection. I see the 2 records added in both of my tables.
    The same code when i set the batchsize 2 and trying to insert 10 records ,I could rollback and no rows get inserted.
    Since I am going to get the no of insert from user in runtime , my rollback may fail in any combinations as in my first case(with batch size 10 and if the no of insert is 2).
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.jdbc.*;
    public class BatchTest{
         public static void main(String args[]) throws Exception{
              Connection conn = null;
              conn = new BatchTest().createConnection();
              new BatchTest().insertdata(conn);
         public Connection createConnection() throws Exception{
                   Properties props =new Properties();
                   props.load(ClassLoader.getSystemResourceAsStream("connection.properties"));
                   String connectionString = (String)props.get("connection");
                   String username = (String)props.get("username");
                   String password = (String)props.get("password");
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   Connection connection = DriverManager.getConnection(connectionString, username, password);
                   return connection;
         public void insertdata(Connection dbConnection){
              PreparedStatement psCnt =null;
              PreparedStatement psImp =null;
              try{
              dbConnection.setAutoCommit(false);
              psCnt = dbConnection.prepareStatement("insert into CHKCNT values (?,?)");
              psImp = dbConnection.prepareStatement("insert into CHKIMP values (?,?)");
              ((OraclePreparedStatement)psCnt).setExecuteBatch (10);
              ((OraclePreparedStatement)psImp).setExecuteBatch (10);
              int x=0;
              for(int i=1;i<=2;i++){
                        psCnt.setInt(1,i);
                        psCnt.setString(2,"Jack");
                        psImp.setInt(1,i);
                        psImp.setString(2,"John");
                        psImp.executeUpdate();
                        psCnt.executeUpdate();
              if(true) x=10/0;
              dbConnection.commit();
              }catch(Exception e){
                   try{
                   dbConnection.rollback();
                   dbConnection.close();
                   }catch(Exception ex){
                   e.printStackTrace();
              }finally{
                   try{
                        psCnt.close();
                   }catch(Exception ee){
                   ee.printStackTrace();
    Can anyone suggest me a way to make my rollback work.
    Thanks in advance.
    -adhil.J

  • Problem with rollback in EJB and CMT

    Hello,
    I faced a problem in my application that I really do not understand (but I really would like to). How can I trigger a rollback of a transaction that is container-managed (CMT)? I know that any system exceptions are supposed to be handled by the container automatically and will cause a transaction rollback when they are thrown from an enterprise bean method. My Problem now is that I'm unable to make this work in my application.
    Consider a situation like this:
    The ManageEntityBean holds a simple save() method that creates an instance of EntityA and another of EntityB. Both instances store an arbitrary number (here 10). After this, the entityManger (injected from the container) is asked to make these instances persistent. EntityB is mapped with a "unique" constraint, so any attempt to store the same number twice will cause an SQL Exception.
    First time when the save() method is invoked, the instances aEntity and bEntity are made permanent in the database. Second time when the save() method is invoked, the database throws an exception because bEntity is violating the unique constraint. What I would expect now is a complete rollback of the whole transaction. Instead, only bEntity has not been made permanent, but aEntity has.
    What's wrong with this code?
    @Stateless
    public class ManageEntityBean implements ManageEntity {
         @PersistenceContext
         private EntityManager entityManager;
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public void save() {
              try {
                   EntityA aEntity = new EntityA(10);
                   EntityB bEntity = new EntityB(10);
                    entityManager.persist(aEntity);
                    entityManager.persist(bEntity);
              } catch (Exception e) {
                   throw new EJBException(e);
    @Entity
    public class EntityA implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
            @Column(name="NUMBER")
            private int   number;
         public EntityA() {}
         public EntityA(int number) {
              this.number = number;
    @Entity
    public class EntityB implements java.io.Serializable {
         @Id
         @GeneratedValue
         private long     id;
         @Column(name = "NUMBER", unique = true)
         private int          number;
         public EntityB() {}
         public EntityB(int number) {
              this.number = number;
    }I found two related topics in this forum but still I didn't find the solution yet.
    [Enterprise JavaBeans - CMT and JDBC|http://forums.sun.com/thread.jspa?forumID=13&threadID=525651]
    and
    [ Forums - A CMT Session Bean Does Not Maintain the Transaction Correctly| http://forums.sun.com/thread.jspa?forumID=13&threadID=161512]
    Maybe anyone can give me a hint. Help is very much appreciated
    Christoph

    Thank you for your input!
    The save() method is simply invoked from the test applications main() method:
    public class Test {
         public static void main(String[] args) {
              JndiUtil<ManageEntity> jndiUtil = new JndiUtil<ManageEntity>();
              ManageEntity handler = jndiUtil.lookupBeanContext("ManageEntityBean", ManageEntity.class);
              handler.save();
    }Btw. I use Hibernate as persistence provider and JBoss 4.2.2.GA as application server.
    For clarity I attach some lines of the debug logging that is produced when the test application is getting started for the second time:
    ### open Session
    17:44:00,555 DEBUG *[SessionImpl] opened session at timestamp: 5007498610909184*
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [JDBCContext] successfully registered Synchronization
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
    17:44:00,555 DEBUG [AbstractEntityManagerImpl] Transaction already joined
    ### invoke em.persist(aEntity)
    17:44:00,555 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,555 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,555 DEBUG *[ConnectionManager] opening JDBC connection*
    17:44:00,555 DEBUG [SQL]
    /* insert de.zippus.domain.EntityA
    17:44:00,556 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityA
    17:44:00,558 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 2
    17:44:00,559 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,559 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,559 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    ### invoke em.persist(bEntity)
    17:44:00,559 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
    17:44:00,559 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    17:44:00,559 DEBUG [ConnectionManager] opening JDBC connection
    17:44:00,559 DEBUG [SQL]
    /* insert de.zippus.domain.EntityB
    17:44:00,560 INFO [STDOUT] Hibernate:
    /* insert de.zippus.domain.EntityB
    17:44:00,561 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    17:44:00,561 DEBUG [ConnectionManager] aggressively releasing JDBC connection
    17:44:00,561 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: >0)]
    17:44:00,561 DEBUG [JDBCExceptionReporter] could not insert: [de.zippus.domain.EntityB] [* insert de.zippus.domain.EntityB */ insert into >ENTITY_B (NUMBER) values (?)]
    com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '10' for key 2
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
    17:44:00,563 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000
    17:44:00,563 ERROR [JDBCExceptionReporter] Duplicate entry '10' for key 2
    17:44:00,563 DEBUG [AbstractEntityManagerImpl] mark transaction for rollback
    17:44:00,563 ERROR [ManageEntityBean] Caught exception: javax.persistence.EntityExistsException: >org.hibernate.exception.ConstraintViolationException: could not insert: [de.zippus.domain.EntityB]
    17:44:00,563 ERROR [ManageEntityBean] Exception Cause: org.hibernate.exception.ConstraintViolationException: could not insert: >[de.zippus.domain.EntityB]
    17:44:00,564 DEBUG *[ManagedEntityManagerFactory] ************** closing entity managersession *************** Up to now I'm not that experienced in reading and understanding this kind of logging, but what I can see is, that there is a transaction that spans the whole unit of work and that this transaction is marked for rollback. I think that's quite a good thing, isn't it?
    But what really puzzles me here is, that both calls of em.persist() result in an opening of a jdbc connection and an immidiate execution of a database insert. Tell me if I'm wrong, but is this really the right place to happen?
    For what reason soever hibernate thinks it has to make these instances permanent, no matter if there is already a session that is taking care of this. If so, I might deal with a wrong hibernate configuration, I checked, but I can't find anything..
    What do you think?
    Thanks in advance!
    Christoph

Maybe you are looking for

  • How to upload pics from sketchbook

    Hi... I'm trying to send pics to email account by using sketchbook pro on ipad. Then need to upload these pics onto powerpoint and need to find a way to compress the file so it is not more than 50MB. Can anyone help thanks.

  • Down Payment clearing push button in MIR7

    Dear Gurus, Hi..... I have created a PO for goods and for freight there is a separate vendor. For this PO i have created Down payment request for goods and down payment request separately for freight vendor also. Now, i have posted the down payments

  • Handling flat files in 'pass through' mode

    Is it possible to handle text files in PI in a pass through mode, i.e. just picking them up from a file adapter, and using another file adapter to send them out e.g. via FTP? Our customer wants to use the traceability of PI to do this. There would be

  • I have deleted users but the free space is not available what did I do wrong

    Not sure what has happened.  I deleted a user and it should have freed up about 150gb of hard drive space.  It hasn't, when I go to about this make and click on storage it is still showing 100gb of space for movies, and 40gb for other, and 10gb for m

  • Why is the YouTube app missing when I updated my software?

    I updated my iPad and the youtube app on my iPad is missing I really like YouTube and in not happy it's gone. Is there a reason apple took it away or is something wrong with my iPad