> Now suppose myEjb.businessMethod call 2 ore 3 BMPs as follows :
>
> myEjb.businessMethod {
> ...
> B1.query();
> B2.query();
> B3.query();
> ...
> }
>
> and in each BMP i have something like this :
>
> B1.query() {
> ...
> Connection conn = getConnection(); // begin an new transaction..
> conn.setAutoCommit(false); // no automatic commit
> conn.execute(q);
> conn.close(); // HERE IS THE PROBLEM I SUPPOSE,
> // even we set Autocommit to false,
> // WHEN WE CLOSE THE CONNECTION EVERYTHING RELATED TO THIS CONNECTION IS
> COMMITED
> ...
> }
java.sql.Connection is an interface. The application server returns you a
concrete implementation of Connection which wraps the specific connection of
the underlying JDBC driver. Calling close() is simply logical. The app
server determines the current state of your transaction, and will either
return the connection to the cache if the tx is complete, or, if the tx is
still pending, will simply ignore your call to close(). This is in much the
same way as getConnection() is logical. In the above case, in a shared
connection model, all the beans are using the exact same connection.
>
> you can see that if the second BMP fails to execute its query for example,
> the first one (wich have previously excuted conn.close) can't rollback
their
> own..
See above.
>
> Now, what happens with Connection Pooling? Simply, when you do
> conn.close().. the App Server give back the connection to the pool and
don't
> close it realy. I suppose that it maintains some local transaction log or
> some CONNEXIONID to communicate with database.
See above, in Sybase EAServer if the tx is still pending we simply do
nothing when you call close().
>
> Realy, i have no idea why App Servers don't support Connection Polling to
> all databases? (at less its the case of Websphere wich supports CP to
> Sybase, DB2 and Oracle)
> I have also no idea how can i manage transactions in the case i have other
> databases ?
This is a limitation of WebSphere. Sybase EAServer supports connection
pooling to any JDBC accessable resource.
Dave Wolf
Internet Applications Division
Sybase
>
>
===========================================================================
> 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".