![]() |
Business Internet Services |
|
DbTransaction executes a number of DbStmt Objects using a single a database Connection. If the database supports commit and rollback, a group of DbStmt tags can be joined together into an atomic transaction. If one statement throws an Exception the entire group can be rolled back. For databases that don't support commit, rollback there still might be an advantage to putting all the stmts in one group. The connection is reserved and not returned to the pool till all the stmts are done. This could be a problem if stmts take a long time to execute. Setting the autocommit attribute to false should only be done when your databases and JDBC driver supports transactions, commit and rollback. A verion of the JDBC driver that we used for MySQL threw and Exception when autocommit was false. This will probably be fixed in a future release and may be done by the time you read this. Besides the dbcon attribute there is another one called dbkey. The value of dbkey is used to store the Connection for children of the DbTransaction. Each DbStmt tag used inside the DbTransaction parent will reference the dbkey to get the Connection that is shared for the transaction. When DtStmt is used outside a DbTransaction it must use the dbcon attribute to get a Connection. Here is an example...
The action attribute specifies the type of stmt to execute. Currently support types are:
The dbcon attribute specifies the name of a DbPool to get a connection from. DbPools are managed by the DbManager which is stored in the ServletContext. @author Mark Ashworth @version 0.1, 3/6/02 Return to Index Note: We have tried to test all of the code examples but they may contain errors. Any questions, comments, suggestions, or problems should be sent to info@plands.com. |
|
© 2005 Planetary
Data Systems.
All rights reserved. |