ALLBASE/SQL Reference Manual (36216-90216)

Chapter 2 103
Using ALLBASE/SQL
Using Multiple Connections and Transactions with Timeouts
Set the current connection to Bank1.
SET CONNECTION 'Bank1'
5. Return from the subroutine to complete the open transaction:
.
.
.
OPEN BankCursor
BULK FETCH BankCursor
INTO :BankArray, :StartIndex, :NumberOfRows
.
.
.
Disconnecting from DBEnvironments
The DISCONNECT statement provides a means of closing one or all active connections within
an application. An active connection is a connection established within the application that
has not been released, stopped, or disconnected.
Your application might require that all connections be terminated when the application
completes. In some cases, it might be desirable to terminate a specific connection at
another point in the application.
In the following example, three database connections are established, and one is
terminated immediately after a transaction completes:
1. Put multi-transaction mode in effect.
SET MULTITRANSACTION ON
2. Connect three times and set a timeout value for each connection. In this case, the
DBEnvironment names and the connection names are specified as host variables.
CONNECT TO 'PartsDBE' AS 'Parts1'
SET USER TIMEOUT 60 SECONDS
CONNECT TO 'SalesDBE' AS 'Sales1'
SET USER TIMEOUT 60 SECONDS
CONNECT TO 'AccountingDBE' AS 'Accounting1'
SET USER TIMEOUT 60 SECONDS
SET CONNECTION 'Parts1'
3. Begin a transaction for PartsDBE.
BEGIN WORK RC
.
.
.