The ODBC and CLI functions that are used to interact with a target database.
| Task |
ODBC 3.0 | SQL/CLI | CLI |
Purpose |
|---|---|---|---|---|
| Connecting to a data source | ||||
| SQLAllocConnect() | Depr | 95 | V1.1 | Obtains a connection handle. |
| SQLAllocEnv() | Depr | 95 | V1.1 | Obtains an environment handle. One environment handle is used for one or more connections. |
| SQLAllocHandle() | Core | 95 | V5 | Obtains a handle. |
| SQLBrowseConnect() | Level 1 | 95 | V5 | Gets required attributes to connect to a data source. |
| SQLConnect() | Core | 95 | V1.1 | Connects to a specific driver by using a data source name, user ID, and password. |
| SQLDriverConnect() | Core | SQL3 | V2.1 1 | Connects to a specific driver by using a connection string
or optionally requests that the Driver Manager and driver display
connection dialogs for the user. Note: This function is also affected
by the additional IBM keywords
supported in the ODBC.INI file.
|
| SQLDrivers() | Core | No | None | CLI does not support this function because this function is implemented by a Driver Manager. |
| SQLSetConnectAttr() | Core | 95 | V5 | Sets connection attributes. |
| SQLSetConnectOption() | Depr | 95 | V2.1 | Sets connection attributes. |
| SQLSetConnection() | No | SQL3 | V2.1 | Sets the current active connection. You have to use this function only when using embedded SQL within a CLI application with multiple concurrent connections. |
| Obtaining information about a driver and data source | ||||
| SQLDataSources() | Lvl 2 | 95 | V1.1 | Returns the list of available data sources. |
| SQLGetInfo() | Core | 95 | V1.1 | Returns information about a specific driver and data source. |
| SQLGetFunctions() | Core | 95 | V1.1 | Returns a list of supported driver functions. |
| SQLGetTypeInfo() | Core | 95 | V1.1 | Returns information about supported data types. |
| Setting and retrieving driver options | ||||
| SQLCreatePkg() | No | No | V9.5 | Binds packages to the database. |
| SQLSetEnvAttr() | Core | 95 | V2.1 | Sets an environment option. |
| SQLGetEnvAttr() | Core | 95 | V2.1 | Returns the value of an environment option. |
| SQLGetConnectAttr() | Lvl 1 | 95 | V5 | Returns the value of a connection option. |
| SQLGetConnectOption() | Depr | 95 | V2.1 1 | Returns the value of a connection option. |
| SQLSetStmtAttr() | Core | 95 | V5 | Sets a statement attribute. |
| SQLSetStmtOption() | Depr | 95 | V2.1 1 | Sets a statement option. |
| SQLGetStmtAttr() | Core | 95 | V5 | Returns the value of a statement attribute. |
| SQLGetStmtOption() | Depr | 95 | V2.1 1 | Returns the value of a statement option. |
| SQLReloadConfig() | No | No | V9.7 | Reloads a configuration property from the client configuration file db2dsdriver.cfg |
| Preparing SQL requests | ||||
| SQLAllocStmt() | Depr | 95 | V1.1 | Allocates a statement handle. |
| SQLPrepare() | Core | 95 | V1.1 | Prepares an SQL statement for later execution. |
| SQLExtendedPrepare() | No | No | V6 | Prepares an array of statement attributes for an SQL statement for later execution. |
| SQLExtendedBind() | No | No | V6 | Bind an array of columns instead of using repeated calls to SQLBindCol() and SQLBindParameter() |
| SQLBindParameter() | Lvl 1 | 95 2 | V2.1 | Assigns storage for a parameter in an SQL statement (ODBC 2.0). |
| SQLSetParam() | Depr | No | V1.1 | Assigns storage for a parameter in an SQL statement (ODBC 1.0).
Note: In ODBC 2.0, this function has been replaced by SQLBindParameter().
|
| SQLParamOptions() | Depr | No | V2.1 | Specifies the use of multiple values for parameters. |
| SQLGetCursorName() | Core | 95 | V1.1 | Returns the cursor name associated with a statement handle. |
| SQLSetCursorName() | Core | 95 | V1.1 | Specifies a cursor name. |
| Submitting requests | ||||
| SQLDescribeParam() | Level 2 | SQL3 | V5 | Returns the description of a parameter marker. |
| SQLExecute() | Core | 95 | V1.1 | Executes a prepared statement. |
| SQLExecDirect() | Core | 95 | V1.1 | Executes a statement. |
| SQLNativeSql() | Lvl 2 | 95 | V2.1 1 | Returns the text of an SQL statement as translated by the driver. |
| SQLNumParams() | Lvl 2 | 95 | V2.1 1 | Returns the number of parameters in a statement. |
| SQLParamData() | Lvl 1 | 95 | V2.1 1 | Used in conjunction with SQLPutData() to supply parameter data at execution time. This is useful for long data values. |
| SQLPutData() | Core | 95 | V2.1 1 | Sends part or all of a data value for a parameter. This is useful for long data values. |
| Retrieving results and information about results | ||||
| SQLRowCount() | Core | 95 | V1.1 | Returns the number of rows affected by an insert, update, or delete request. |
| SQLNumResultCols() | Core | 95 | V1.1 | Returns the number of columns in the result set. |
| SQLDescribeCol() | Core | 95 | V1.1 | Describes a column in the result set. |
| SQLColAttribute() | Core | Yes | V5 | Describes attributes of a column in the result set. |
| SQLColAttributes() | Depr | Yes | V1.1 | Describes attributes of a column in the result set. |
| SQLColumnPrivileges() | Level 2 | 95 | V2.1 | Gets privileges associated with the columns of a table. |
| SQLSetColAttributes() | No | No | V2.1 | Sets attributes of a column in the result set. |
| SQLBindCol() | Core | 95 | V1.1 | Assigns storage for a result column and specifies the data type. |
| SQLFetch() | Core | 95 | V1.1 | Returns a result row. |
| SQLFetchScroll() | Core | 95 | V5 | Returns a rowset from a result row. |
| SQLExtendedFetch() | Depr | 95 | V2.1 | Returns multiple result rows. |
| SQLGetData() | Core | 95 | V1.1 | Returns part or all of one column of one row of a result set. This is useful for long data values. |
| SQLMoreResults() | Lvl 1 | SQL3 | V2.1 a | Determines whether there are more result sets available and, if so, initializes processing for the next result set. |
| SQLNextResult() | No | Yes | V7.1 | Provides nonsequential access to multiple result sets returned from a stored procedure. |
| SQLError() | Depr | 95 | V1.1 | Returns additional error or status information. |
| SQLGetDiagField() | Core | 95 | V5 | Gets a field of diagnostic data. |
| SQLGetDiagRec() | Core | 95 | V5 | Gets multiple fields of diagnostic data. |
| SQLSetPos() | Level 1 | SQL3 | V5 | Sets the cursor position in a rowset. |
| SQLGetSQLCA() | No | No | V2.1 | Returns the SQLCA associated with a statement handle. |
| SQLBulkOperations() | Level 1 | No | V6 | Performs bulk insertions, updates, deletions, and fetches by bookmark. |
| Descriptors | ||||
| SQLCopyDesc() | Core | 95 | V5 | Copies descriptor information between handles. |
| SQLGetDescField() | Core | 95 | V5 | Gets single field settings of a descriptor record. |
| SQLGetDescRec() | Core | 95 | V5 | Gets multiple field settings of a descriptor record. |
| SQLSetDescField() | Core | 95 | V5 | Sets a single field of a descriptor record. |
| SQLSetDescRec() | Core | 95 | V5 | Sets multiple field settings of a descriptor record. |
| Large object support | ||||
| SQLBindFileToCol() | No | No | V2.1 | Associates a LOB file reference with a LOB column. |
| SQLBindFileToParam() | No | No | V2.1 | Associates a LOB file reference with a parameter marker. |
| SQLGetLength() | No | SQL3 | V2.1 | Gets the length of a string referenced by a LOB locator. |
| SQLGetPosition() | No | SQL3 | V2.1 | Gets the position of a string within a source string referenced by a LOB locator. |
| SQLGetSubString() | No | SQL3 | V2.1 | 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 about the data source's system tables (catalog functions) | ||||
| SQLColumns() | Lvl 1 | SQL3 | V2.1 1 | Returns the list of column names in specified tables. |
| SQLExtendedProcedures() | No | No | V9.7 | Returns the list of procedure names stored in a specific data source with additional information. |
| SQLExtendedProcedureColumns() | No | No | V9.7 | Returns the list of input and output parameters for the specified procedures with additional information. |
| SQLForeignKeys() | Lvl 2 | SQL3 | V2.1 | Returns the list of column names that comprise foreign keys, if they exist for a specified table. |
| SQLPrimaryKeys() | Lvl 1 | SQL3 | V2.1 | Returns the list of column names that comprise the primary key for a table. |
| SQLProcedureColumns() | Lvl 2 | No | V2.1 | Returns the list of input and output parameters for the specified procedures. |
| SQLProcedures() | Lvl 2 | No | V2.1 | Returns the list of procedure names stored in a specific data source. |
| SQLSpecialColumns() | Core | SQL3 | V2.1 1 | Returns information about the optimal set of columns that uniquely identifies a row in a specified table. |
| SQLStatistics() | Core | SQL3 | V2.1 1 | Returns statistics about a single table and the list of indexes associated with the table. |
| SQLTablePrivileges() | Lvl 2 | SQL3 | V2.1 | Returns a list of tables and the privileges associated with each table. |
| SQLTables() | Core | SQL3 | V2.1 1 | Returns the list of table names stored in a specific data source. |
| Terminating a statement | ||||
| SQLFreeHandle() | Core | 95 | V1.1 | Frees handle resources. |
| SQLFreeStmt() | Core | 95 | V1.1 | Ends statement processing and closes the associated cursor, discards pending results, and, optionally, frees all resources associated with the statement handle. |
| SQLCancel() | Core | 95 | V1.1 | Cancels an SQL statement. |
| SQLTransact() | Depr | No | V1.1 | Commits or rolls back a transaction. |
| SQLCloseCursor() | Core | 95 | V5 | Commits or rolls back a transaction. |
| Terminating a connection | ||||
| SQLDisconnect() | Core | 95 | V1.1 | Closes the connection. |
| SQLEndTran() | Core | 95 | V5 | Ends the transaction of a connection. |
| SQLFreeConnect() | Depr | 95 | V1.1 | Releases the connection handle. |
| SQLFreeEnv() | Depr | 95 | V1.1 | Releases the environment handle. |
| Creating and dropping a database | ||||
| SQLCreateDb() | No | No | V9.7 | Creates a database based on the specified database name, code-set, and mode. |
| SQLDropDb() | No | No | V9.7 | Drops the specified database. |
| Note:
Depr in the ODBC column indicates that the function has been deprecated for ODBC. The following
limitations apply to ODBC functions:
|
||||