Attaching to the Services Manager with isc_service_attach( )
Go Up to Overview of the Services API
Use the Services API function isc_service_attach()
to initiate a connection from your application to a remote InterBase Services Manager.
You must supply a local or remote service name to specify which host to attach. This string resembles InterBase database connection strings, in that the syntax determines the network protocol used to connect the client application to the Services Manager on the server host.
Protocol | Syntax | Supported server platform |
---|---|---|
TCP/IP |
|
any |
NetBEUI |
|
Windows server platforms |
Local |
|
any |
Replace serverhost
with the hostname of your InterBase database server. In all cases, the string service_mgr
is a literal string.
The user ID you use to attach to the Services Manager is the user ID the Services Manager uses to perform tasks by your request. Note that some service tasks can be performed only by the SYSDBA user ID.
Example 1: Attaching to a Services Manager in C/C++
char *user = "SYSDBA",
*password = "masterkey", /* see security tip below */
Example 2: *service_name = "jupiter:service_mgr";
ISC_STATUS status[20];
isc_svc_handle *service_handle = NULL;
spb_buffer[128], *spb = spb_buffer;
unsigned short spb_length;
*spb++ = isc_spb_version;
*spb++ = isc_spb_current_version;
*spb++ = isc_spb_user_name;
*spb++ = strlen(user);
strcpy(spb, user);
spb += strlen(user);
*spb++ = isc_spb_password;
*spb++ = strlen(password)
strcpy(spb, password);
spb += strlen(password);
spb_length = spb - spb_buffer;
if (isc_service_attach(status, 0, service_name, &service_handle,
spb_length, spb_buffer)) {
isc_print_status(status);
exit(1);
}