Current Session
Each thread must designate a current session by executing the connect statement or a session switching statement. The session remains current until disconnected or another session switching statement is executed. If a thread is terminated with a current session, the session will be inaccessible until a new thread with the same thread ID as the original thread is created.
A session may be current on only one thread at any given moment. Attempting to switch to a session that is current on some other thread produces an error and no change in session is made. A session is not limited to the thread that created it; a thread may switch to any non-current session.
A thread may switch away from a session without selecting another session to be made current. Using the identifier NONE in place of the connection name or session ID in a session switching statement makes the current session accessible to other threads while leaving the current thread with no current session. The thread will need to switch to a session prior to executing any subsequent ESQL statements.
A thread may disconnect its own current session, or any session not current on another thread. Attempting to disconnect a session current on another thread results in an error being issued. The disconnect all statement may not be issued when sessions are current on any other thread.