19.2.2 a_rdb_SQLConnect() (establish a connection)
- Organization of this subsection
(1) Function
This CLI function establishes a connection with the HADB server.
(2) Format
signed short a_rdb_SQLConnect ( void *ConnectionHandle, /* In */ char *UserID, /* In */ char *Password, /* In */ a_rdb_SQLResultInfo_t *ResultInfo, /* In */ void *Option /* In */ )
(3) Arguments
- ConnectionHandle
-
Specifies a connection handle.
- UserID
-
Specifies the authorization identifier to be used to connect to the HADB server, as a character string in C or C++.
- Password
-
Specifies the password for the authorization identifier that was specified for UserID, in the representation of a character string in C or C++ language.
For details about the rules for passwords, see Specification format and rules for the CREATE USER statement in the manual HADB SQL Reference.
- ResultInfo
-
Specifies for each CLI function the address where the SQL results information is to be stored. SQL results information is returned to the specified area until a_rdb_SQLDisconnect() is issued.
If the specified address is NULL, SQL results information is not returned.
For details about the a_rdb_SQLResultInfo_t structure, see 19.7.6 a_rdb_SQLResultInfo_t structure (SQL results information).
- Option
-
Specifies NULL.
(4) Return value
-
If a_rdb_SQLConnect() terminates normally, a_rdb_RC_SQL_SUCCESS is returned.
-
If the connection is established successfully, but the disk containing server message log files or client message log files has become full, a_rdb_RC_SQL_WARNING is returned.
-
If an error occurs while messages cannot be output to the client message log file, the error cause code is returned. For details about the error cause code, see 19.8 Return values of the CLI functions.
(5) Notes
a_rdb_SQLConnect() cannot be executed in the following cases:
-
An HADB user who does not have the CONNECT privilege executed this CLI function.
-
Connection has already been established.
-
An invalid authorization identifier is specified.
-
A character encoding that differs from that for the HADB server is specified in ADBCLTLANG.
-
The number of connections to the HADB server has reached the maximum number of concurrent connections.