|
| Copyright © Cloud Software Group, Inc. All Rights Reserved |
The JDBC Get Connection activity retrieves an object reference to a JavaConnectionAccessor object for the specified JDBC Connection from the connection pool. This allows you to use the optimized TIBCO ActiveMatrix BusinessWorks database connection pool instead of specifying database configuration information in your Java code. This database connection can then be used within Java activities to access the specified database.
See Using The JDBC Connection in Java for more information on using the JDBC Get Connection activity.
Path to the shared configuration resource containing the JDBC connection information. See JDBC Connection for more information about JDBC resources.
This is an optional element that appears only when the property java.property.bw.activity.output.stats.elapsedTime.JDBCGetConnectionActivity is set to true in designer.tra. For run-time, set the property to true in the bwengine.tra file. By default, the property is set to false.You can turn off the property and not calculate the elapsed time at run-time by setting the property java.property.bw.activity.output.stats.elapsedTime.turnoff in the bwengine.tra file. However, note that setting this property will turn off the calculation of elapsed time at run-time for all the JDBC activities.The Error Output tab lists the possible exceptions that can be thrown by this activity. See TIBCO ActiveMatrix BusinessWorks Error Codes for more information about error codes and corrective action to take.
• The JDBC Get Connection activity creates a JavaConnectionAccessor object reference that can be passed to an input parameter of a Java Code or Java Method activity. See Passing Java Objects Between Java Code Activities for details on how to pass Java object references between activities.
• java.sql.Connection getDBConnection(); — retrieves a database connection from the connection pool.
• void releaseConnection(); — releases a database connection so that it can return to the connection pool.
• boolean isTransactional(); — returns true if the activity using the JDBC connection is in a transaction group and the Override Transaction Behavior on the Configuration tab of the JDBC Get Connection activity is unchecked.
• void releaseConnection(SQLException ex) — releases the connection obtained by way of the getDBConnection() method. Use this method instead of the standard releaseConnection method because this method detects if the SQL Exception passed as input is due to a connection problem. If the connection is no longer usable, it is destroyed and it is not returned to the connection pool.When the connection is part of a transaction, the JavaConnectionAccessor object prevents you from committing or rolling back the transaction. The transaction will complete when the transaction group either commits or rolls back. If the connection is part of an XA transaction group, the enlist and delist operations are performed by the getDBConnection and releaseConnection methods.
Your code should check for SQL Exceptions returned when executing JDBC statements. If you encounter an unexpected SQL Exception, you can use the releaseConnection(SQLException ex) method to release the connection. This allows you to check if the connection is no longer valid. If the connection is no longer valid, your Java code should return an appropriate exception for subsequent activities so that transactions can be rolled back, if necessary.
|
| Copyright © Cloud Software Group, Inc. All Rights Reserved |