Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trasaction management.

 
Arun Natarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following snippet in a BMT session bean:



1. In the above code instead of connection.close() can I do a connection.commit()? If it is legal, will the c1.commit() be permanent even if c2.commit() fails?

2.DataSource API says:
The DataSource interface is implemented by a driver vendor. There are three types of implementations:

1. Basic implementation -- produces a standard Connection object
2. Connection pooling implementation -- produces a Connection object that will automatically participate in connection pooling. This implementation works with a middle-tier connection pooling manager.
3. Distributed transaction implementation -- produces a Connection object that may be used for distributed transactions and almost always participates in connection pooling. This implementation works with a middle-tier transaction manager and almost always with a connection pooling manager.


If you have the 3rd type of implementation in your driver then the above code snippet will work fine, but if you have type 1 or 2 implementation then is it possible that c1 commits and c2 does not?

3. Instead of a datasource lookup if I do a DriverManager.getConnection(), how does that affect the transactions?

Thanks,
Arun N
[ September 14, 2006: Message edited by: Arun Natrajan ]
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one doubt..about this ques..
can you say..connection.commit()..as you asked..
 
Arun Natarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if i can say conn.commit() and that is part of my first question. Is it legal to say conn.commit()?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic