ctsqlConnect
Establishes a connection with a FairCom DB SQL database using DSQL.
Declaration
CTSQLRET ctsqlConnect(pCTSQLCONN hConn, CTSQLCHAR* dbname, CTSQLCHAR* username, CTSQLCHAR* password)
Description
ctsqlConnect() establishes a connection with a FairCom DB SQL database. If a connection is active, ctsqlConnect() will disconnect the current connection and try to obtain a new connection.
Note: To set SSL options, call ctsqlSetSSL before calling ctsqlConnect.
Usage
If you are remotely connecting to your server, the SQL port and DNS name need to be specified in the connection string supplied for the dbname parameter. The format is as follows:
c-treeSQLPort@DNS:DatabaseName
The defaults for FairCom DB SQL are:
The resulting connection string would be: 6597@localhost:ctreeSQL
Return
ctsqlConnect() returns CTSQLRET_OK on success.
Symbolic Constant |
Explanation |
SQL_ERR_BADPARAM |
Bad parameter specification for the statement. |
SQL_ERR_NOMEM |
Memory allocation failure. |
See Also
ctsqlDisconnect(), ctsqlNewConnection(), ctsqlSetSSL