Kenneth:

Distributed or global transactions require 2
components, a transaction manager, and one or more
resource managers. The transaction manager talks to
the various resource managers using some protocol
(such as X/Open in case of encina), and orchestrates
the 2 phase commit, while the resource managers in
turn commit or rollback the txn on their respective
data sources. Access to data involved in the
transactions is determined by the txn isolation that
is set for that txn.

>   Second, Javasoft recommends opening and closing db
> connections within 3very
> database-related method.

Firstly, when you get a handle to a connection object,
it does not necessarily imply creation of a new
database connection, typically the connection will
come from a pool, and will be associated with the
connection object only during execution of a query.
Secondly, when a global txn is started, the txn
context is associated with the current thread of
execution, and this txn context is used to identify
the txn to the txn managers and the resource managers.

Hope this helps.
 - Chinmay.

--- "Kenneth D. Litwak" <[EMAIL PROTECTED]>
wrote:
> This is not precisely a contnuation of the current
> thread, but the header does
> address my questions.
>
> 1.  Does the EJB spec specify two=phase commit for
> EJBs, via, I presuem, JTA?
> That is, if I am runnign a transaction, with
> multiple emthod calls, each of
> which should cause an update to the database, and
> hence, as I understand it, an
> ejbSStore () (is this always called for an entity
> bean method?), at some point
> the local resource managers have to do a commit().
> What ifI'm accessing
> multiple data sources?  Does he commit() in each
> resource manager happen and
> then the transaction commit?  What if one resorue
> maanager fails to do a commit?
>  Does the container take notice of this, and if so,
> how can it rollback changes
> already committed in another resoruce amanger?
>
>   Second, Javasoft recommends opening and closing db
> connections within 3very
> database-related method.  That raises a problem for
> me, unless (I'mmissing
> something.  Here's a scenario to show why:
>
>   Mtthod a opens a connection, updates the database
> and closes the coonnection.
>   Method B opens a connection, does some work and
> closes the connection.
>
>   NOq, two questions:
>
>   Assuming these two methods were called under the
> same transaction:
>   If method B fails (could be in the same or a
> different bean), how does the
> container know that it needs to rollback what
> happened in method A, since
> there's no longer a "connection" between the bean
> instance and the database?
> That is, nohting is tracking, so far as I know, what
> was changed by method A
> anymore.  WIll this situation simply fail to call
> commit() on any local resource
> maanger, thus causing the cahched changes (cached in
> the database) to be
> ignroed?  Or what?  How will the dbms know that work
> done unde a different, now
> gone, database connection needs to be rolled back,
> since commits are generally
> done on a local resourcce manager on work done in a
> given connection.  That
> connection, however, is now hitory.
>
>   Ken Litwak
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff EJB-INTEREST".  For general
> help, send email to
> [EMAIL PROTECTED] and include in the body of the
> message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff EJB-INTEREST".  For general
> help, send email to
> [EMAIL PROTECTED] and include in the body of the
> message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff EJB-INTEREST".  For general
> help, send email to
> [EMAIL PROTECTED] and include in the body of the
> message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff EJB-INTEREST".  For general
> help, send email to
> [EMAIL PROTECTED] and include in the body of the
> message "help".
>


__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to