Each function has its own ODBC 3.0 conformance level, and Db2 ODBC support level, and certain
functions are deprecated.
Each of the following tables provides a list of functions
that support a particular task. The tables indicate the level of
Db2 ODBC support and and Microsoft ODBC 3.0 conformance
level for each function.
The table contains the following values,
by column:
- ODBC 3.0 level
- The values of this column have the following meanings:
- No
- Indicates that the function is not supported by ODBC 3.0.
- Deprecated
- Indicates that the function is supported but deprecated in ODBC
3.0.
- Core
- Indicates that the function is part of the ODBC 3.0 Core conformance
level.
- Level 1
- Indicates that the function is part of the ODBC 3.0 Level 1 conformance
level.
- Level 2
- Indicates that the function is part of the ODBC 3.0 Level 2 conformance
level.
- Db2 ODBC support
- The values of this column have the following meanings:
- No
- Indicates that the function is not supported by Db2 ODBC.
- Deprecated
- Indicates that the function is supported but deprecated in Db2 ODBC.
- Current
- Indicates that the function is current for Db2 ODBC. A current function is supported by Db2 ODBC and is not deprecated by
another Db2 ODBC function.
Connecting to a data source
Table 1. Functions
for connecting to a data source
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLAllocConnect() |
Deprecated |
Deprecated |
Obtains a connection handle. |
SQLAllocEnv() |
Deprecated |
Deprecated |
Obtains an environment handle. One environment
handle is used for one or more connections. |
SQLAllocHandle() |
Core |
Current |
Obtains a handle. |
SQLBrowseConnect() |
Level 1 |
No |
Returns successive levels of connection attributes
and valid attribute values. When a value is specified for each connection
attribute, this function connects to the data source. |
SQLConnect() |
Core |
Current |
Connects to a specific driver by data source name,
user ID, and password. |
SQLDriverConnect() |
Core |
Current |
Connects to a specific driver with a connection
string.
IBM® specific: This
function is also extended with the additional IBM keywords that are supported in the ODBC.INI
file in the Db2 for Linux®, UNIX, and Windows CLI
environment. Within the Db2 for z/OS® ODBC
environment, the ODBC.INI file has no equivalent.
|
SQLSetConnection() |
No |
Current |
Connects to a specific data source by connection
string. |
Obtaining information about a driver and data source
Table 2. Functions for obtaining information about a driver
and data source
Function name |
ODBC 3.0 level |
Status in Db2 ODBC |
Purpose |
SQLDataSources() |
Core |
Current |
Returns the list of available data sources. |
SQLDrivers() |
Core |
No |
Returns the list of installed drivers and their
attributes (ODBC 2.0). This function is implemented within the ODBC
driver manager and is therefore not applicable within the Db2 for z/OS ODBC
environment. |
SQLGetFunctions() |
Core |
Current |
Returns supported driver functions. |
SQLGetInfo() |
Core |
Current |
Returns information about a specific driver and
data source. |
SQLGetTypeInfo() |
Core |
Current |
Returns information about supported data types. |
Setting and retrieving driver attributes
Table 3. Functions for setting and retrieving driver attributes
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLGetConnectAttr() |
Core |
Current |
Returns the value of a connection attribute. |
SQLGetConnectOption() |
Deprecated |
Deprecated |
Returns the value of a connection attribute. |
SQLGetEnvAttr() |
Core |
Current |
Returns the value of an environment attribute. |
SQLGetStmtAttr() |
Core |
Current |
Returns the value of a statement attribute. |
SQLGetStmtOption() |
Deprecated |
Deprecated |
Returns the value of a statement attribute. |
SQLSetConnectAttr() |
Core |
Current |
Sets a connection attribute. |
SQLSetConnectOption() |
Deprecated |
Deprecated |
Sets a connection attribute. |
SQLSetEnvAttr() |
Core |
Current |
Sets an environment attribute. |
SQLSetStmtAttr() |
Core |
Current |
Sets a statement attribute. |
SQLSetStmtOption() |
Deprecated |
Deprecated |
Sets a statement attribute. |
Setting and retrieving descriptor fields
Table 4. Functions for setting and retrieving descriptor
fields
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLCopyDesc() |
Core |
No |
Copies descriptor fields. |
SQLGetDescField() |
Core |
No |
Returns the value or current setting of a single
descriptor field. |
SQLGetDescRec() |
Core |
No |
Returns the values or current settings of multiple
descriptor fields. |
SQLSetDescField() |
Core |
No |
Sets the value or setting for a single descriptor
field. |
SQLSetDescRec() |
Core |
No |
Sets the values or settings for multiple descriptor
fields. |
Preparing SQL requests
Table 5. Functions
for preparing SQL requests
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLAllocStmt() |
Deprecated |
Deprecated |
Allocates a statement handle. |
SQLBindFileToParam() |
No |
Current |
Associates a parameter marker in an SQL statement
with a file reference or an array of file references. |
SQLBindParameter() |
Core |
Current |
Assigns storage for a parameter in an SQL statement
(ODBC 2.0). |
SQLGetCursorName() |
Core |
Current |
Returns the cursor name that is associated with
a statement handle. |
SQLParamOptions() |
Deprecated |
Current |
Specifies the use of multiple values for parameters. In ODBC 3.0, SQLSetStmtAttr() replaces
this function. |
SQLPrepare() |
Core |
Current |
Prepares an SQL statement for subsequent execution. |
SQLSetCursorName() |
Core |
Current |
Specifies a cursor name. |
SQLSetParam() |
Deprecated |
Deprecated |
Assigns storage for a parameter in an SQL statement
(ODBC 2.0). In ODBC 3.0, SQLBindParameter() replaces
this function. |
SQLSetScrollOptions() |
Deprecated |
No |
Sets attributes that control cursor behavior. In
ODBC 3.0, SQLGetInfo() and SQLSetStmtAttr() replace
this function. |
Submitting requests
Table 6. Functions
for submitting requests
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLDescribeParam() 1 |
Core |
Current |
Returns the description for a specific input parameter
in a statement. |
SQLExecDirect() |
Core |
Current |
Executes a statement. |
SQLExecute() |
Core |
Current |
Executes a prepared statement. |
SQLNativeSql() |
Core |
Current |
Returns the text of an SQL statement as translated
by the driver. |
SQLNumParams() |
Core |
Current |
Returns the number of parameters in a statement. |
SQLParamData() |
Core |
Current |
Used with SQLPutData() . Supplies
parameter data at execution time. (Useful for long data values.) |
SQLPutData() |
Core |
Current |
Sends part or all of a data value for a parameter.
(This function is useful for long data values.) |
Retrieving results and information about results
Table 7. Functions for retrieving results and information about results
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLBindCol() |
Core |
Current |
Assigns storage for a result column and specifies
the data type. |
SQLBindFileToCol() |
No |
Current |
Associates a LOB column in a result set to a file
reference or an array of file references. |
SQLBulkOperations() |
Level 1 |
Current |
Performs bulk inserts operations. |
SQLColAttribute() |
Core |
Current |
Describes attributes of a column in the result
set. |
SQLColAttributes() |
Deprecated |
Deprecated |
Describes attributes of a column in the result
set. |
SQLDescribeCol() |
Core |
Current |
Describes a column in the result set. |
SQLError() |
Deprecated |
Deprecated |
Returns additional error or status information. |
SQLExtendedFetch() |
Deprecated |
Current |
Returns multiple result rows. |
SQLFetch() |
Core |
Current |
Returns a result row. |
SQLFetchScroll() |
Core |
Current |
Returns row sets that are specified
by absolute or relative position. |
SQLGetData() |
Core |
Current |
Returns part or all of one column of one row of
a result set. (This function is useful for long data values.) |
SQLGetDiagRec() |
Core |
Current |
Returns additional diagnostic information. |
SQLGetSQLCA() |
No |
Current |
Returns the SQLCA that is associated with a statement
handle. |
SQLMoreResults() |
Level 1 |
Current |
Determines whether more result sets are available
and, if so, initializes processing for the next result set. |
SQLNumResultCols() |
Core |
Current |
Returns the number of columns in the result set. |
SQLRowCount() |
Core |
Current |
Returns the number of rows that are affected by
an insert, update, delete, or merge request. |
SQLSetColAttributes() |
No |
Current |
Sets attributes of a column in the result set. |
SQLSetPos() |
Level 1 |
Current |
Allows an application to refresh,
update, delete, and insert rows in the rowset |
Handling large objects
Table 8. Functions
for handling large objects
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLGetLength() |
No |
Current |
Gets the length, in bytes, of a string that is
referenced by a LOB locator. |
SQLGetPosition() |
No |
Current |
Gets the position of a string within a source string
that is referenced by a LOB locator. |
SQLGetSubString() |
No |
Current |
Creates a new LOB locator that references a substring
within a source string. (The source string is also represented by
a LOB locator.) |
Obtaining information from the catalog
Table 9. Functions for obtaining catalog information
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLColumnPrivileges() |
Level 2 |
Current |
Returns a list of columns and associated privileges
for a table. |
SQLColumns() |
Core |
Current |
Returns the list of column names in specified tables. |
SQLForeignKeys() |
Level 2 |
Current |
Returns a list of column names that comprise foreign
keys, if they exist, for a specified table. |
SQLPrimaryKeys() |
Level 1 |
Current |
Returns the list of column names that comprise
the primary key for a table. |
SQLProcedureColumns() |
Level 1 |
Current |
Returns the list of input and output parameters,
as well as the columns that make up the result set for the specified
procedures. |
SQLProcedures() |
Level 1 |
Current |
Returns the list of procedure names that are stored
in a specific data source. |
SQLSpecialColumns() |
Core |
Current |
Returns information about the optimal set of columns
that uniquely identifies a row in a specified table, or identifies
the columns that are automatically updated when any value in the row
is updated by a transaction. |
SQLStatistics() |
Core |
Current |
Returns statistics about a single table and the
list of indexes that are associated with the table. |
SQLTablePrivileges() |
Level 2 |
Current |
Returns a list of tables and the privileges that
are associated with each table. |
SQLTables() |
Core |
Current |
Returns the list of table names that are stored
in a specific data source. |
Terminating a statement
Table 10. Functions
for terminating a statement
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLCancel() |
Core |
Current |
Cancels an SQL statement. |
SQLCloseCursor() |
Core |
Current |
Closes a cursor that has been opened on a statement
handle. |
SQLEndTran() |
Core |
Current |
Commits or rolls back a transaction. |
SQLFreeStmt() |
Core |
Current |
Ends statement processing, closes the associated
cursor, discards pending results, and, optionally, frees all resources
that are associated with the statement handle. |
SQLTransact() |
Deprecated |
Deprecated |
Commits or rolls back a transaction. |
Terminating a connection
Table 11. Functions
for terminating a connection
Function name |
ODBC 3.0 level |
Db2 ODBC support |
Purpose |
SQLDisconnect() |
Core |
Current |
Closes the connection. |
SQLFreeConnect() |
Deprecated |
Deprecated |
Releases the connection handle. |
SQLFreeEnv() |
Deprecated |
Deprecated |
Releases the environment handle. |
SQLFreeHandle() |
Core |
Current |
Releases an environment, connection, statement,
or descriptor handle. |
ODBC 3.0 functions that are not supported by Db2 ODBC
The following
ODBC 3.0 functions are not supported by Db2 ODBC:
SQLBrowseConnect()
.
SQLCopyDesc()
. Db2 ODBC
does not support descriptor fields.
SQLDrivers()
. This function is implemented by
the ODBC driver manager which does not apply to Db2 ODBC.
SQLGetDescField()
. Db2 ODBC
does not support descriptor fields.
SQLGetDescRec()
. Db2 ODBC
does not support descriptor fields.
SQLSetDescField()
. Db2 ODBC
does not support descriptor fields.
SQLSetDescRec()
. Db2 ODBC
does not support descriptor fields.
SQLSetScrollOptions(
). This function is superseded
by the following statement attributes:
SQL_ATTR_CURSOR_TYPE
SQL_ATTR_CONCURRENCY
SQL_KEYSET_SIZE
SQL_ATTR_ROWSET_SIZE