This content has been marked as final.
Show 3 replies
-
1. Re: Transactions in JBoss
francis17101970 Sep 9, 2008 3:01 AM (in response to rohit.macherla)Hello,
oh no, don't use Class.forName. Use JBoss Connection pool at firstContext ctx = new InitialContext(); javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myJtsDataSource"); java.sql.Connection conn = ds.getConnection();
You have to register a Datasource and place it in the deploy directory of jBoss. Of course you could write your own Conn Pool and delegate transaction management to the RDBMS but it's lots of work, and then why using an Application Server if you don't use its services ?
Then from your Web Service you can start your own transactions yet I would advice you if you have experience at EJB, handle your business logic in an EJB either BMT or CMT. With EJB 3.0 it's pretty easier, no configuration files are needed to handle transactions. -
2. Re: Transactions in JBoss
jhalliday Sep 9, 2008 6:06 AM (in response to rohit.macherla)> This approach works
.. but only as long as your application can tolerate invocations of the web service without the corresponding database updates. The server may crash after invoking the web service but before committing the database updates. Or the commit on the database may fail. -
3. Re: Transactions in JBoss
rohit.macherla Sep 9, 2008 9:59 AM (in response to rohit.macherla)@francis17101970
Thanks for the information. We have put a jboss-ds.xml file in the Deploy structure of the JBoss. But the datasource is mentioned as<local-tx-datasource>
Hope this doesn't destroy the purpose there are some XA datasources available as well (not in my jboss-ds.xml, but I found in the internet that XA datasources can also be configured) and I am unaware of their purpose.
We'll also check if we can shift to EJB from the Servlets that we are using. But just one query here, in case we shift to EJB, does that mean that JCA need not be involved in my development ? I mean, because we'd be using CMP beans and as they'll take care of some part of the transactions, should I still use JCA somewhere because I've read that it deals with non-relational resources too?
@jhalliday
I've understood the problem you are referring to. One generic query here : Using EJB's here will not solve this problem, isnt' it ? I mean, if the server crashes even during the process or COMMITing, the method commit() should return an appropriate value I guess. Thanks.