16.5.1 SQLSetConnectAttr, SQLSetConnectAttrW
- Organization of this subsection
(1) Function
This ODBC function sets connection attributes.
(2) Format
-
For SQLSetConnectAttr
SQLRETURN SQLSetConnectAttr ( SQLHDBC ConnectionHandle, /* In */ SQLINTEGER Attribute, /* In */ SQLPOINTER ValuePtr, /* In */ SQLINTEGER StringLength /* In */ )
-
For SQLSetConnectAttrW
SQLRETURN SQLSetConnectAttrW ( SQLHDBC ConnectionHandle, /* In */ SQLINTEGER Attribute, /* In */ SQLPOINTER ValuePtr, /* In */ SQLINTEGER StringLength /* In */ )
(3) Arguments
- ConnectionHandle
-
Specifies a connection handle for which connection attributes are to be set.
- Attribute
-
Specifies the connection attributes to be set. For details about the attributes that can be specified, see 16.14 Attributes that can be specified in SQLSetConnectAttr, SQLSetConnectAttrW, SQLGetConnectAttr, and SQLGetConnectAttrW.
- ValuePtr
-
Specifies a pointer to the values to be associated with Attribute or a 32-bit integer value. For details about the values that can be specified, see 16.14 Attributes that can be specified in SQLSetConnectAttr, SQLSetConnectAttrW, SQLGetConnectAttr, and SQLGetConnectAttrW.
- StringLength
-
Specifies the length of *ValuePtr (in bytes). If ValuePtr is an integer, this argument is ignored.
If ValuePtr is a pointer to a character string, this argument specifies the length of the character string (in bytes) or SQL_NTS.
(4) Return value
This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
(5) SQLSTATE
This ODBC function returns one of the following SQLSTATE values:
SQLSTATE |
Description |
Remarks |
Returned |
---|---|---|---|
01000 |
General warning |
-- |
N |
01S02 |
Option value changed |
Y |
|
08002 |
Connection name in use |
N |
|
08003 |
Connection does not exist |
N |
|
08S01 |
Communication link failure |
N |
|
24000 |
Invalid cursor status |
N |
|
25000 |
Invalid operation in local transaction |
N |
|
3D000 |
Invalid catalog name |
N |
|
HY000 |
General error |
N |
|
HY001 |
Memory allocation error |
N |
|
HY008 |
Operation cancelled |
N |
|
HY009 |
Invalid use of null pointer |
N |
|
HY010 |
Function sequence error |
N |
|
HY011 |
Attribute cannot be set now |
Y |
|
HY013 |
Memory management error |
N |
|
HY024 |
Invalid attribute value |
Y |
|
HY090 |
Invalid string or buffer length |
The following conditions are all satisfied:
|
Y |
HY092 |
Invalid attribute or option identifier |
-- |
Y |
HY114 |
The driver does not support asynchronous execution at the connection level |
N |
|
HY117 |
Connection suspended |
N |
|
HY121 |
Cursor library and driver-dependent connection pooling cannot be executed concurrently |
N |
|
HYC00 |
Optional feature not implemented |
The specified Attribute is a valid argument, but it is not supported by the driver. |
Y |
HYT01 |
Connection timeout expired |
-- |
N |
IM001 |
Driver does not support this function |
N |
|
IM009 |
Unable to load translation DLL |
N |
|
IM017 |
Invalid asynchronous polling |
N |
|
IM018 |
Incomplete asynchronous execution |
N |
|
S1118 |
The driver does not support asynchronous notification |
N |
- Legend:
-
Y: This SQLSTATE might be returned by the HADB ODBC driver.
N: This SQLSTATE is not returned by the HADB ODBC driver.
--: None
(6) Notes
-
If you specify a value for Attribute that is specific to HADB; that is, one that does not exist in the ODBC conventions, include adbodb.h.
-
The transaction access mode specified in this function (the attribute is SQL_ATTR_ACCESS_MODE) is determined based on the priorities shown in the following table (the smaller the priority number, the higher the priority).
Table 16‒5: Priorities of transaction access mode Priority
Specification location of transaction access mode
1
SQLSetConnectAttr or SQLSetConnectAttrW
2
adb_clt_trn_access_mode operand in the client definition