In this section: |
The following table summarizes possible combinations of actions and events:
Actions |
Events | |||
---|---|---|---|---|
COMMIT |
COMMIT |
COMMAND |
CRTFORM |
FIN |
X |
D |
S* |
S | |
CLOSE (DB2 CAF and Teradata only) |
S*** |
S |
X |
D |
DISCONNECT (DB2, and Oracle only) |
S** |
S |
X |
D |
Note: * Supported within a MODIFY procedure only. Not needed for Teradata.
The following sections discuss the advantages and disadvantages of certain combinations of actions and events.
This command works only from within a MODIFY procedure and requires a slightly different syntax:
SQL SET AUTOCOMMIT ON CRTFORM
Note the absence of the target database qualifier after the SQL keyword. Including a qualifier generates a syntax error.
This is the "COMMIT as often as possible" strategy. FOCUS issues a COMMIT prior to displaying each CRTFORM, thus releasing all locks before presenting data to the user. AUTOCOMMIT ON CRTFORM invokes Change Verify Protocol (CVP). You must check the FOCURRENT variable to determine whether CVP detected a conflict with another user. Maintaining Tables With FOCUS discusses this setting and some limits on its use. This setting also requires the KEYS value in the Access File to be greater than zero.
With this strategy, more concurrent users can access the same DB2 data. However, a COMMIT carries overhead and may be unnecessary for the application.
At the end of the MODIFY procedure, the event setting reverts to its value before the AUTOCOMMIT ON CRTFORM was issued.
For Teradata, each SQL statement is implicitly committed. Therefore, this setting is not needed.
During the FOCUS session, only those COMMIT and ROLLBACK commands you issue explicitly are executed. The adapter automatically issues a COMMIT at the end of the FOCUS session. The syntax is
{ENGINE|SQL} [sqlengine] SET AUTOCOMMIT ON FIN
where:
Indicates the target RDBMS. Valid values are DB2, SQLDBC, SQLIDMS, or SQLORA. Omit if you previously issued the SET SQLENGINE command.
With this setting, you do not incur COMMIT overhead until the end of the FOCUS session. You can also use it to suspend the COMMIT action for a period of time. See Explicit Control of a Logical Unit of Work (LUW) for an example.
Maintain does not support the AUTOCOMMIT ON FIN setting.
Holding unneeded locks can cause contention in the system and make other users wait for data. Delaying the COMMIT also puts data changes at risk in case of system or machine failure.
SET AUTOCOMMIT ON FIN gives you full control of Logical Units of Work (LUWs) within your FOCUS session. FOCUS relies on your explicit COMMIT and ROLLBACK commands. No implicit COMMIT or ROLLBACK is ever forced until the end of the FOCUS session (FIN command). Use this option cautiously to avoid possible locking problems and unpredictable consequences in cases of conflict with other AUTOaction settings.
Note:
This setting closes the DB2 thread at the end of each command or logs off from the Teradata RDBMS. The syntax is:
{ENGINE|SQL} [DB2|SQLDBC] SET AUTOCLOSE ON COMMAND
Omit the DB2 or SQLDBC qualifier if you previously issued the SET SQLENGINE command.
This setting releases some virtual storage, but there is a cost to repeatedly initializing a thread. Also, closing a thread does not make it available to other users. Only a disconnect can release it.
Note: AUTOCLOSE is ignored for IDMS/SQL and Oracle. See the description of AUTODISCONNECT for a comparable function.
For DB2, when a COMMIT is issued, the CAF facility disconnects the FOCUS session from DB2, terminating the DB2 thread. For Oracle, this setting logs off the Oracle RDBMS. The syntax is
{ENGINE|SQL} [sqlengine] SET AUTODISCONNECT ON COMMIT
where:
Indicates the target RDBMS. Valid values are DB2 or SQLORA. Omit if you previously issued the SET SQLENGINE command.
This setting frees the DB2 thread for use by other users or logs off the Oracle RDBMS. The disadvantage is the cost of repeatedly connecting to DB2 and acquiring a thread. Threads, once released, may not be available when needed, so you may experience delays while your request waits for a thread.
Note:
The adapter issues a DB2 CAF CLOSE at the end of the FOCUS session or sponsors a LOGOFF from the Teradata RDBMS. The syntax is
{ENGINE|SQL} [DB2|SQLDBC] SET AUTOCLOSE ON FIN
Omit the DB2 or SQLDBC qualifier if you previously issued the SET SQLENGINE command.
This setting duplicates adapter default behavior, unless the adapter was installed with AUTOCLOSE ON COMMAND as the default.
Note: AUTOCLOSE is ignored for IDMS SQL and Oracle. See the description of AUTODISCONNECT for a comparable function.
This command disconnects FOCUS from the RDBMS at the end of the FOCUS session, duplicating adapter default behavior. The syntax is
{ENGINE|SQL} [sqlengine] SET AUTODISCONNECT ON FIN
where:
Indicates the target RDBMS. Valid values are DB2 or SQLORA. Omit if you previously issued the SET SQLENGINE command.
Note: DISCONNECT is ignored for Teradata and IDMS/SQL.
Information Builders |