wcDBOpen( )

Syntax . . Returns . . Tips . . Program Example . . Related Topics . . A-Z Index . . Home

Opens a managed connection to the database server for the current session.

Example

returnCode = wcDBOpen(cntrlHandle, "conn2", "clients@sirius",
                      "user76", "pass76");

Syntax

int wcDBOpen(void *controlHandle, 
             char *conName, 
             char *server,
             char *userID, 
             char *passwd)
controlHandleThe handle to the control structure.
conNameThe name to associate with the connection. Must be only alphanumeric and underscore (_) characters, with a maximum of 18 characters. Use the connection name returned by wcAppPageConnName() to open a connection to the AppPages repository. If you want to use the connection in your AppPages, conName has to be the connection name you use in AppPages, plus the session ID appended at the end. See Tips section for more information.
serverThe database name, server name, or both for the connection. Syntax is databaseName@serverName.
userIDThe database user ID which is requred to log in to the database.
passwdThe password for the database user.

Returns

0Success.
Error codeFailure or exception. For a list of possible error codes, see Error Messages.

Tips

Program Example

The following code shows how wcDBOpen( ) is used in an application.

    wcGetVariable(wcp, "$SESSION_ID", &sessID);

    if (sessID!=NULL)
        sprintf(connName, "MYCONN%s", sessID);
    
    wcDBOpen(wcp, connName, dbname, dbuser, dbpass);

Related Topics

wcAppPageConnName( )
wcDBClose( )
wcDBSet( )


Top of Page . . Syntax . . Returns . . Tips . . Program Example . . A-Z Index . . Home