home *** CD-ROM | disk | FTP | other *** search
- .Na "dbopen"
- .Aa
- .Fu
- Create and initialize a DBPROCESS structure.
- .Ih "DBPROCESS structure, allocating"
- .Ih "\*S connection, establishing"
- .Ih "\*S, logging into"
- .Ih "logging into \*S"
- .Sy
- .Sf "DBPROCESS *dbopen(login, server)"
- .Sp "LOGINREC" "*login"
- .Sp "char" "*server"
- .Co
- .Bl
- This routine allocates and initializes a DBPROCESS structure.
- This structure is the basic data structure that \*L
- uses to communicate with \*S.
- It is the first argument in almost every \*L call.
- Besides allocating
- the DBPROCESS structure, this routine sets up communication with
- the network, logs into \*S, and initializes any default options.
- .Bl
- Here's a program fragment that uses \f2dbopen()\fP:
- .ta +4n +4n +4n +4n +4n +4n
- .SD
- .ne 7
- .so dbopen.ex
- .ED
- .Bl
- Once the application has logged into a \*S, it can change databases
- by calling the \f2dbuse()\f1 routine.
- .Bl
- An asynchronous version of \f2dbopen()\f1, called \f2dbopen_a()\f1, is available for VMS.
- .Bz
- .Pa
- .Pi login
- A pointer to a LOGINREC structure. This pointer will be passed as
- an argument to
- .I "dbopen()."
- You can get one by calling
- .I "dblogin()."
- .sp 0.5v
- Once the application has made all its \f2dbopen()\f1 calls,
- the LOGINREC structure is no longer necessary.
- The program can then call \f2dbloginfree()\f1 to free
- the LOGINREC structure.
- .Pi server
- The \*S that you want to connect to.
- \f2server\f1 is the alias given to the server in the \f2interfaces\f1 file.
- .Ih "interfaces file"
- \f2dbopen()\f1 looks up \f2server\f1 in the
- \f2interfaces\f1 file to get information for connecting to a \*S.
- .sp 0.5v
- If \f2server\f1 is NULL
- (and you have not called \f2dbsetconnect()\f1 as described below),
- \f2dbopen()\f1 looks up the \f2interfaces\f1 entry that corresponds to
- the value of the DSQUERY environment variable or logical name.
- .Ih "DSQUERY environment variable"
- .Ih "DSQUERY logical name"
- If DSQUERY has not been explicitly set, it has a value of ``SYBASE''.
- (For information on designating an \f2interfaces\f1 file, see the manual page
- for \f2dbsetifile()\f1.
- For more information on the \f2interfaces\f1 file itself,
- see the \f2SYBASE Installation Guide\f1.)
- .sp 0.5v
- You specify a value for this parameter only if
- you want the \f2interfaces\f1 file to determine the \*S connection.
- If the \f2dbsetconnect()\f1 routine
- has previously been called to determine the \*S connection,
- this parameter is ignored and should be NULL.
- .in -.375i
- .Re
- .br
- A DBPROCESS pointer if everything went well.
- Ordinarily,
- \f2dbopen()\f1 returns NULL
- if a DBPROCESS structure couldn't be created or initialized, or if your login
- to \*S failed.
- When \f2dbopen()\f1 returns NULL,
- it generates a \*L error number that indicates the error.
- The application can access this error number through an error handler.
- However, if there's an unexpected communications failure during the \*S
- login process and an error
- handler has not been installed, the program will be aborted.
- .Er
- .in -.375i
- .I "dbopen()"
- will return NULL if any of the following are true:
- .nf
- .ta +18n
- .sp 0.5v
- SYBEMEM Unable to allocate sufficient memory.
- .sp 0.25v
- SYBEDBPS Maximum number of DBPROCESSes already allocated.
- .sp 0.25v
- SYBESOCK Unable to open socket.
- .sp 0.25v
- SYBEINTF Server name not found in interfaces file.
- .sp 0.25v
- SYBEUHST Unknown host machine name.
- .sp 0.25v
- SYBECONN Unable to connect: \*S is unavailable or does not exist.
- .sp 0.25v
- SYBEPWD Login incorrect.
- .sp 0.25v
- SYBEOPIN Could not open interfaces file.
- .Sa
- dbclose,
- dbexit,
- dbinit,
- dblogin,
- dbloginfree,
- dbopen_a,
- dbsetconnect,
- dbsetifile,
- dbuse
-