SQLConnect
SQLConnect#
SQLConnect connects the Altibase CLI driver with the database. The connection handle refers to all data related to the database connection including connection status, transaction status, and error data.
SQLConnectW() as a Unicode string supports same execution as SQLConnect().
Syntax#
SQLRETURN SQLConnect (
SQLHDBC dbc,
SQLCHAR * db,
SQLSMALLINT dbLength,
SQLCHAR * usr,
SQLSMALLINT usrLength,
SQLCHAR * pwd,
SQLSMALLINT pwdLength );
Arguments#
Data Type | Argument | In/Output | Description |
---|---|---|---|
SQLHDBC | dbc | Input | Connection handle |
SQLCHAR * | db | Input | Host IP |
SQLSMALLINT | dbLength | Input | The character of number of *db |
SQLCHAR * | usr | Input | User identifier |
SQLSMALLINT | usrLength | Input | The character number of *usr |
SQLCHAR * | pwd | Input | Authentication character string (password) |
SQLSMALLINT | pwdLength | Input | The character number of *pwd |
Return Values#
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
Description#
The input length Arguments (dbLength, usrLength, pwdLength) can be set to actual length of the related data. SQL_NTS to indicate that the related data terminated with NULL, or a length value that does not include a NULL termination character can be set.
SQLAllocConnect() must be called before this function.
This function must be called before SQLAllocStmt().
Informations such as IP address, user name, and password can be set by SQLSetConnectAttr() as an argument string.
Set the parameters excepting dbc on null or zero in the distributed transaction(Reference the SQLSetConnectAttr).
Diagnosis#
SQLSTATE | Description | Comments |
---|---|---|
08001 | Cannot be connected to the server. | Altibase CLI driver cannot establish connection with the database. |
08002 | The connection name is already in use | The corresponding dbc is already connected to the database. |
08S01 | Communication channel error | Communication channel error before the function processing is completed between the Altibase CLI driver and the database. |
HY000 | General error | The character set does not exist. |
HY001 | Memory allocation error | Cannot allocate the requested memory for the Altibase CLI driver to execute the function and complete execution. |
Related Functions#
SQLAllocHandle
SQLDisconnect
SQLDriverConnect
SQLSetConnectAttr