Using Database Handles

From InterBase

Go Up to DSQL Limitations (Application Requirements)


Database handles are always static, and can only be declared when an application is coded. Enough handles must be declared to satisfy the expected needs of users. Once a handle is declared, it can be assigned to a user-specified database at run time with SET DATABASE, as in the following C code fragment:

. . .
EXEC SQL
SET DATABASE DB1 = 'dummydb.ib';
EXEC SQL
SET DATABASE DB2 = 'dummydb.ib';
. . .
printf("Specify first database to open: ");
gets(fname1);
printf("\nSpecify second database to open: ");
gets(fname2);
EXEC SQL
SET DATABASE DB1 = :fname1;
EXEC SQL
SET DATABASE DB2 = :fname2;
. . .

For a complete discussion of SET DATABASE, see Working with Databases.

Advance To: