-
1. Re: NoTxConnectionManager with JDBC - how to use in containe
davidjencks Sep 26, 2002 11:52 PM (in response to genman)Well, a message driven bean with cmt does use xids anyway. If you were to use a jdbc 1/local tx driver the xids for the db don't get out of the jboss vm, so they have essentially no cost: you would however be committing after every message. If you use NoTxConnectionManager jboss will not attempt to enroll your connection in the tx: the connection will be left (or put) in autocommit = true state. I'm not sure this has ever been tested with an XADataSource based driver, but it works fine for jdbc 1 drivers. This should be a good solution for you.
If you don't mind my asking... what does the mdb do if it doesn't write anything anywhere? -
2. Re: NoTxConnectionManager with JDBC - how to use in containe
genman Oct 11, 2002 12:10 AM (in response to genman)I'm reading routing information from the database.
I did get NoTxConnection manager to work... yay!
I was wondering if there was a way to use a managed
connection from an MBean, for example, (look at the
billing-service.xml file attached), I want to use
the 'billing' datasource to log records to the database
using an MBean. Periodically I get exceptions:
Caused by: java.sql.SQLException: Connection handle is not currently associated with a ManagedConnection
at org.jboss.resource.adapter.jdbc.local.LocalConnection.checkStatus(LocalConnection.java:774)
at org.jboss.resource.adapter.jdbc.local.LocalConnection.checkTransaction(LocalConnection.java:755)
at org.jboss.resource.adapter.jdbc.local.LocalStatement.checkTransaction(LocalStatement.java:771)
at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeUpdate(LocalPreparedStatement.java:305)
at com.proteusmobile.oamp.mdr.MdrDBAppender.logDB(MdrDBAppender.java:200)
... 31 more
Is this a bug or am I configuring things incorrectly?
I'm using Oracle, and it seems to be a "problem". -
3. Re: NoTxConnectionManager with JDBC - how to use in containe
davidjencks Oct 13, 2002 11:17 AM (in response to genman)Can you show some code from your mbean? The only way I know to make this happen is to use a instance variable to hold your connection and use it without synchronization. If you hold the connection in a method local variable or synchronize any method that uses the connection this should not occur.
-
4. Re: NoTxConnectionManager with JDBC - how to use in containe
genman Oct 20, 2002 2:22 PM (in response to genman)Yes, I wrote the MBean without synchronization. Thanks for the hint.
I "fixed" it so that connections aren't shared between threads and it works. I sort of gathered from how it was behaving that the JBoss classes weren't thread-safe. I had wondered when I wrote it if that was the intention or not.