dbConnect(3dba)


dbConnect -- establish a connection to a database

Synopsis

cc [flag ...] file ... -kthread -leels [library] ...
#include <eelsdba.h>

DBConn *dbConnect( char *host, int port, char *dbName, char *appname, int flags);

Description

dbConnect establishes a connection to a database, and returns a connection ID that can be passed to other database access routines to identify the database connection.

Arguments


host
(Input) The host where the database server is running. This can either be a hostname, or an IP address in dot notation (for example, 192.168.24.1). If the database is running on the local machine, or the database does not support remote connections, this field should be set to NULL.

port
(Input) The TCP port number that the database is listening on. If the database is listening on the default port (defined by the database) or the database does not support remote connections, this field should be set to NULL.

dbName
(Input) The name of the database that the application wants to access.

appname
(Input) A descriptive name for the connection.

flags
(Input) Flags affecting the characteristics of the connection to the database server. DB_EELSD_REMOTE_RESULT indicates that the database server should store the results of a dbQuery until the client asks for them with dbGetNextRow. DB_EELSD_LOCAL_RESULT causes the client to download the entire result of a dbQuery.

Return values

If a connection is successfully established to the database, dbConnect returns a pointer to a DBConn structure. If an error occurs, dbConnect returns NULL.

Diagnostics

An application can call dbGetError(3dba) to obtain the error message returned from the database.

References

dbGetError(3dba), Intro(3dba)


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004