DBInit
DBInit Initiate a session with a data server
#include <DatabaseAccess.h> Data Access Manager
OSErr DBInit( sessID, ddevName, host, user, passwd, connStr,
asyncPB);
long * sessID ; specifies a session ID
ConstStr63Param ddevName; specifies the name of the database extension
ConstStr255Param host ; specifies the name of the host system
ConstStr255Param user ; is the name of the user
ConstStr255Param passwd ; is the password associated with the user
ConstStr255Param connStr; is a string that is passed to the data server
DBAsyncParmBlkPtr asyncPB; is a pointer to the asynchronous parameter
block
returns Error Code; 0=no error
The DBInit function initiates a session with a data server. You must initiate a
session before you call any Data Access Manager function that requires a
session ID as an input parameter. If the DBInit function returns a nonzero
session ID, you must call the DBEnd function to terminate the session, even if
the DBInit function also returns a result code other than noErr.
Because the high-level function DBStartQuery can call the DBInit
function, you do not have to call the DBInit function if you have called the
DBStartQuery function.
sessID specifies the ID of the session. This session ID is unique; no other
current session, for any database extension, has the same session ID.
You must specify the session ID any time you want to send data to or
retrieve data from this session. Depending on the database extension
you are using, the DBInit function might return a session ID of zero
if it fails to initiate a session, or it might return a nonzero session
ID and a result code other than noErr. In the latter case, you can pass
the session ID to the DBGetErr function to determine the cause of
the error.
ddevName is a string of no more than 63 characters that specifies the name of
the database extension. The name of the database extension is
contained in the database extension file in a resource of type 'STR '
with an ID of 128. For the Data Access Language database extension
provided by Apple, for example, this string is "DAL".
host specifies the name of the host system on which the data server is
located. This name depends on the manner in which the database
extension initiates communication with the data server and how the
system administrator has set up the computer system.
user specifies the name of the user.
passwd specifies the password associated with the user name.
connStr is a string that is passed to the data server, which might pass it on
to the database management software on the host computer. This
string is necessary in some systems to complete log-on procedures.
asyncPB is a pointer to the asynchronous parameter block. If you do not want
to call the function asynchronously, set this parameter to NIL.
Returns: an operating system Error Code.
noErr (0) No error
rcDBError (-802) Error initiating session
rcDBBadDDev (-808) Couldn't find the specified database extension, or error
occurred in opening database extension
rcDBAsyncNotSupp (-809) The database extension does not support asynchronous
calls
rcDBPackNotInited (-813) The InitDBPack function has not yet been called