Ritu Kedia wrote:

Thanks Oliver for looking into this.

By tx-datasource, I think you are referring to the SQLServer deployment file
I posted on JBoss forum, which has <no-tx-datasource>. If yes, then even

Yes.

using <local-tx-datasource> does not solve the problem. AFAIK the
no-tx-datasource just implies that the transactions are not managed by the

Ah, yes, so this would not work, as the transaction must be managed by Slide, right?


Container. Irrespective of the type of the datasource, the container always
sets autocommit to true on the connection. I observed that even Slide's

Which is very unlikely, isn't it? How could a the J2EE server have control over transactions with autocommit on?


JDBCStore is setting autocommit to false on getNewConnection(). The patch
below does just the same for J2EEStore.

OK, ok, ok, you win ;)

I will apply it!

SelectMethod=direct does not work in manual transaction mode.

Well, I though, it does when there is only one open statement per connection which is what Slide guarantees, right?


Oliver

Regards,
Ritu


-----Original Message-----
From: Oliver Zeigermann [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 22, 2004 6:51 PM
To: Slide Developers Mailing List
Subject: Re: AutoCommit Problem with the Connection returned by
J2EEStore


- Why don't you configure your datasource as tx-datasource? Doesn't this work?
- OT: You can also try to use SelectMethod=direct as someone reported this might be faster


Oliver

Ritu Kedia wrote:


I had reported this error some time back but forgot to pursue it, since I
did a local fix and moved ahead. This problem surfaced again today when I
tried to deploy the jakarta_slide code from CVS Head.


Bug description: When Slide is deployed in JBoss App Server, the connections returned by

the

J2EEStore have autocommit set to true. As a result the tx commits and
rollbacks fail and further call for a new transaction fails with the
following error:
17:39:26,796 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Loading namespace slide base

data

17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.transaction.SlideTransaction - WARNING - Rollback

failure:

Resource manager org.apache.slide
[EMAIL PROTECTED] Error code XA_HEURCOM in Transaction 1
xid main-1087906166828-1- in thread main
17:39:26,843 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Init namespace slide
configuration
17:39:26,906 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.Namespace - INFO - Import data into namespace

slide

17:39:26,937 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.common.XMLUnmarshaller - INFO - Loading object /
17:39:26,953 INFO  [STDOUT] 22 Jun 2004 17:39:26 -
org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
Resource manager org.apache.slide.s
[EMAIL PROTECTED] Error code XAER_INVAL in Transaction 3

xid

main-1087906166906-3- in thread main
17:39:27,156 INFO  [STDOUT] 22 Jun 2004 17:39:27 -
org.apache.slide.transaction.SlideTransaction - WARNING - Enlist failure:
Resource manager org.apache.slide.s
[EMAIL PROTECTED] Error code XAER_INVAL in Transaction 3

xid

main-1087906166906-3- in thread main
...... same error repeats several times

Atleast with JBoss it is not possible to declaratively set autocommit to
false on DB Connections. I had confirmed this with JBoss support(ref:
http://jboss.org/index.html?module=bb&op=viewtopic&t=48838). I have not
tested with Weblogic and Websphere.

Bug fix: Setting autocommit to false when returning the connection from
J2EEStore. This fix should not cause any problems on other app servers
either.

Patch: Please find attached the patch for J2EEStore. I hope someone could
look at this.

Regards,
Ritu
<<autocmmit_patch.txt>>






------------------------------------------------------------------------

Index: J2EEStore.java
===================================================================
RCS file:

/home/cvspublic/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/J 2EEStore.java,v

retrieving revision 1.11
diff -u -r1.11 J2EEStore.java
--- J2EEStore.java      11 Feb 2004 11:30:21 -0000      1.11
+++ J2EEStore.java      22 Jun 2004 12:49:35 -0000
@@ -155,6 +155,10 @@
    }

    protected Connection getNewConnection() throws SQLException {
-        return ds.getConnection();
+               Connection con = ds.getConnection();
+               boolean autoCommit = con.getAutoCommit();
+               if(autoCommit)
+                       con.setAutoCommit(false);
+               return con;
    }
}



------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to