21. 4GL Statement Glossary : Connect : Creating Multiple Sessions
 
Share this page                  
Creating Multiple Sessions
The connect statement establishes a session. If your application requires more than one session, you can assign a session identifier or number to each session, and use the set connection or set_sql(session) statements to switch sessions. For a detailed discussion of multiple sessions, see Multiple Session Connections.
Using Session Identifiers
To assign a numeric session identifier to a connection, specify the session clause; for example:
connect accounting session 99;
assigns the numeric session identifier 99 to the connection to the "accounting" database. To determine the session identifier for the current session, use the inquire_sql(session) statement. To switch sessions using the numeric session identifier, use the set_sql(session) statement; for example:
set_sql(session = 99);
Using Connection Names
To assign a name to a connection, specify the as clause; for example:
connect act107b as accounting;
assigns the name "accounting" to the connection to the "act107b" database. To switch sessions using the connection name, use the set connection statement; for example:
set connection accounting;
If you omit the as clause, Ingres assigns a default connection nameā€”the database specified in the connect statement. You can subsequently use this connection name in set connection statements to switch session. If you omit the as clause and specify a numeric session identifier (using the session clause), the default connection name is "iin," where n is the specified numeric session identifier.
To determine the connection name for the current session, use the inquire_sql(connection_name) statement.