Question : DB2 temporary table - How long does a DB2 Session last?  What is the Session's lifespan?

I was using a DB2 temporary table and the concept of the session came up in the declaration:

DECLARE GLOBAL TEMPORARY TABLE SESSION.SERIAL_NUM_TO_SHIP (SerIDNum INTEGER);

Does anyone know when the session starts and then finishes?

Answer : DB2 temporary table - How long does a DB2 Session last?  What is the Session's lifespan?

Hi jwrite,

For this purpose, a session ends (and the table is dropped) when the connection to the database is closed.

Using the CLI as an example.

db2
connect to mydatabase -- session starts
declare global temporary table session.mytable (id integer)
-- miscellaneous commands
terminate -- session ends


The table should exists as long as the client program (the CLI in this example) maintains a connection to the database.



Kent
Random Solutions  
 
programming4us programming4us