Using a Database Handle

From InterBase

Go Up to Using simple CONNECT Statements


If a program uses SET DATABASE to provide database handles, those handles should be used in subsequent CONNECT statements instead of hard-coded names. For example,

. . .
EXEC SQL
SET DATABASE DB1 = 'employee.ib';
EXEC SQL
SET DATABASE DB2 = 'employee2.ib';
EXEC SQL
CONNECT DB1;
EXEC SQL
CONNECT DB2;
. . .

There are several advantages to using a database handle with CONNECT:

  • Long file specifications can be replaced by shorter, mnemonic handles.
  • Handles can be used to qualify table names in multi-database transactions. DSQL applications do not support multi-database transactions.
  • Handles can be reassigned to other databases as needed.
  • The number of database cache buffers can be specified as an additional CONNECT parameter.

For more information about setting the number of database cache buffers, see Setting Database Cache Buffers.

Advance To: