Accessing Local Databases

From InterBase

Go Up to Multi-Instance

Windows platform only.

In order to access a database on a local InterBase server, InterBase depends on the InterBase Environment variable to identify the server to be connected to. A pre-7.5 InterBase server running will be connected to if no server with the InterBase environment variable setting is running.

In order to access an older server make sure that your application uses the older gds32.dll. To access a older server using a 7.5 InterBase client library make sure your InterBase environment variable is set to a empty string "".

Applications can also pass in the information regarding the InterBase server they want to attach to as part of the InterBase database parameter block (isc_dpb parameter). Setting the isc_dpb_client_interbase_var followed by the length and the location of the InterBase server will allow the user to specify the InterBase server to be used. The following code demonstrates how a client should set the dpb parameter to attach to a InterBase server running with the InterBase environment variable set to "c:/interbase"

#include <ibase.h>
char dpb_buffer[256], dpb;
short dpb_length;
char *ib_server = "c:/interbase";
char *str = "employee.ib";
isc_db_handle db1;
ISC_STATUS status_vector[20];
/* construct the dpb, specifing the IB server to attach to */
dpb = dpb_buffer;
*dpb++ = isc_dbp_version;
*dpb++ = isc_dpb_client_interbase_var;
*dpb++ = strlen(ib_server);
strcpy (dpb, ib_server);
/* set other dpb parameters */
/* set the dpb_length as usual */
dpb_length = dpb - dpb_buffer;
/* finally call isc_attach or create with the dpb parameters */
isc_attach_database(status_vector, strlen(str), str, &db1, dpb_length, dpb_buffer);

Advance To: