SQL Reference
This section outlines the connection states that an
application process may enter.
Connection States:
- An application process is in one of four states at any time:
- Connectable and connected
- Unconnectable and connected
- Connectable and unconnected
- Implicitly connectable (if implicit connect is available).
If implicit connect is available (see Figure 4), the application process is initially in the
implicitly connectable state. If implicit connect is not
available (see Figure 5), the application process is initially in the
connectable and unconnected state.
Availability of implicit connect is determined by installation options,
environment variables, and authentication settings. See the Quick Beginnings for information on setting implicit connect on installation and the Administration Guide for information on environment variables and authentication settings.
The implicitly connectable state:
- If implicit connect is available, this is the initial state of an
application process. The CONNECT RESET statement causes a transition to
this state. Issuing a COMMIT or ROLLBACK statement in the unconnectable
and connected state followed by a DISCONNECT statement in the connectable and
connected state also results in this state.
The connectable and connected state:
- An application process is connected to an application server and CONNECT
statements can be executed.
If implicit connect is available:
- The application process enters this state when a CONNECT TO statement or a
CONNECT without operands statement is successfully executed from the
connectable and unconnected state.
- The application process may also enter this state from the implicitly
connectable state if any SQL statement other than CONNECT RESET, DISCONNECT,
SET CONNECTION, or RELEASE is issued.
Whether or not implicit connect is available, this state is entered
when:
- A CONNECT TO statement is successfully executed from the connectable and
unconnected state.
- A COMMIT or ROLLBACK statement is successfully issued or a forced rollback
occurs from the unconnectable and connected state.
The unconnectable and connected state:
- An application process is connected to an application server, but a
CONNECT TO statement cannot be successfully executed to change application
servers. The process enters this state from the connectable and
connected state when it executes any SQL statement other than the following
statements: CONNECT TO, CONNECT with no operand, CONNECT RESET,
DISCONNECT, SET CONNECTION, RELEASE, COMMIT or ROLLBACK.
The connectable and unconnected state:
- An application process is not connected to an application server.
The only SQL statement that can be executed is CONNECT TO, otherwise an error
(SQLSTATE 08003) is raised.
Whether or not implicit connect is available:
- The application process enters this state if an error occurs when a
CONNECT TO statement is issued or an error occurs in a unit of work which
causes the loss of a connection and a rollback. An error caused because
the application process is not in the connectable state or the server-name is
not listed in the local directory does not cause a transition to this
state.
If implicit connect is not available:
- the CONNECT RESET and DISCONNECT statements cause a transition to this
state.
State Transitions are shown in the following diagrams.
Figure 4. Connection State Transitions If Implicit Connect Is Available
Figure 5. Connection State Transitions If Implicit Connect Is Not Available
Additional Rules:
- It is not an error to execute consecutive CONNECT statements because
CONNECT itself does not remove the application process from the connectable
state.
- It is an error to execute consecutive CONNECT RESET statements.
- It is an error to execute any SQL statement other than CONNECT TO, CONNECT
RESET, CONNECT with no operand, SET CONNECTION, RELEASE, COMMIT, or ROLLBACK,
and then execute a CONNECT TO statement. To avoid the error, a CONNECT
RESET, DISCONNECT (preceded by a COMMIT or ROLLBACK statement), COMMIT, or
ROLLBACK statement should be executed before executing the CONNECT TO.
[ Top of Page | Previous Page | Next Page ]