Supported ODBC functions
Tip
The SQLGetInfo
function returns general information about the driver and data source associated with a connection.
To retrieve a full list of supported functions, call SQLGetFunctions
.
For more information about the ODBC functions, see the ODBC Programmer’s Reference.
The following table describes the supported ODBC functions.
Deprecated functions are preserved for backward compatibility.
Function |
Standard |
Description |
SQLAllocHandle |
ISO 92 |
Allocates an environment, connection, statement, or descriptor handle. |
SQLConnect |
ISO 92 |
Establishes a connection to the driver and data source using connection information that is passed as the data source name, username, and password arguments. |
SQLDriverConnect |
ODBC |
This function is an alternative to the SQLConnect function. SQLDriverConnect is used to connect to the data source using a connection string. It supports data sources that require more connection information than the three arguments in SQLConnect , dialog boxes to prompt the user for additional connection information, and data sources that are not defined in the system information. |
SQLAllocEnv |
Deprecated |
Allocates an environment handle. This function was replaced by SQLAllocHandle in ODBC 3.x. |
SQLAllocConnect |
Deprecated |
Allocates a connection handle. This function was replaced by SQLAllocHandle in ODBC 3.x. |
SQLDataSources |
ISO 92 |
Returns information about the data source. This function is implemented only by the Driver Manager. |
SQLDrivers |
ODBC |
Returns the driver descriptions and driver attribute keywords. This function is implemented only by the Driver Manager. |
SQLGetInfo |
ISO 92 |
Returns general information about the driver and data source associated with a connection. |
SQLGetFunctions |
ISO 92 |
Returns information about whether the driver supports a specific ODBC function. |
SQLGetTypeInfo |
ISO 92 |
Returns information about the data types supported by the data source. |
Setting and retrieving driver attributes
SQLSetConnectAttr |
ISO 92 |
Sets a connection attribute. |
SQLGetConnectAttr |
ISO 92 |
Returns the value of a connection attribute. |
SQLSetConnectOption |
Deprecated |
Sets a connection option. This function was replaced by SQLSetConnectAttr in ODBC 3.x. |
SQLGetConnectOption |
Deprecated |
Returns the value of a connection option. This function was replaced by SQLGetConnectAttr in ODBC 3.x. |
SQLSetEnvAttr |
ISO 92 |
Sets an environment attribute. |
SQLGetEnvAttr |
ISO 92 |
Returns the value of an environment attribute. |
SQLSetStmtAttr |
ISO 92 |
Sets a statement attribute. |
SQLGetStmtAttr |
ISO 92 |
Returns the value of a statement attribute. |
SQLSetStmtOption |
Deprecated |
Sets a statement option. This function was replaced by SQLSetStmtAttr in ODBC 3.x. |
SQLGetStmtOption |
Deprecated |
Returns the value of a statement option. This function was replaced by SQLGetStmtAttr in ODBC 3.x. |
Preparing SQL statements
SQLAllocStmt |
Deprecated |
Allocates a statement handle. This function was replaced by SQLAllocHandle in ODBC 3.x. |
SQLPrepare |
ISO 92 |
Prepares an SQL statement for execution. |
SQLBindParameter |
ODBC |
Binds a buffer to a parameter marker in an SQL statement. |
SQLGetCursorName |
ISO 92 |
Returns the cursor name associated with a specified statement. |
SQLSetCursorName |
ISO 92 |
Associates a cursor name with an active statement. |
SQLSetScrollOptions |
ODBC |
Sets options that control the cursor behavior. This function was replaced by SQLGetInfo and SQLSetStmtAttr in ODBC 3.x. |
Executing SQL statements
SQLExecute |
ISO 92 |
Executes a prepared statement. |
SQLExecDirect |
ISO 92 |
Executes a preparable statement, using the current values of the parameter marker variables if any parameters exist in the statement. |
SQLNativeSql |
ODBC |
Returns a translated SQL string. This function doesn’t execute an SQL statement. |
SQLDescribeParam |
ODBC |
Returns the description of a parameter marker associated with a prepared SQL statement. |
SQLNumParams |
ISO 92 |
Returns the number of parameters in an SQL statement. |
SQLParamData |
ISO 92 |
This function is used together with SQLPutData to supply parameter data at execution time, and with SQLGetData to retrieve streamed output parameter data. |
SQLPutData |
ISO 92 |
Enables an application to send data for a parameter or column to the driver at execution time. |
Retrieving results
SQLRowCount |
ISO 92 |
Returns the number of rows affected by an UPDATE, INSERT, or DELETE statement. |
SQLNumResultCols |
ISO 92 |
Returns the number of columns in a result set. |
SQLDescribeCol |
ISO 92 |
Returns the result descriptor (column name, type, column size, decimal digits, and nullability) for a column in a result set. |
SQLColAttribute |
ISO 92 |
Returns the result descriptor for a column in a result set. Unlike SQLDescribeCol , which returns a specific set of arguments, SQLColAttribute can be used to specify which attribute you want to receive for a specific column. |
SQLColAttributes |
Deprecated |
Returns the result descriptor for a column in a result set. This function was replaced by SQLColAttribute in ODBC 3.x. |
SQLFetch |
ISO 92 |
Returns the next rowset of data from a result set and returns data for all bound columns. |
SQLFetchScroll |
ISO 92 |
Returns the specified rowset of data from a result set and returns data for all bound columns. |
SQLExtendedFetch |
Deprecated |
Returns the specified rowset of data from a result set and returns data for all bound columns. This function was replaced by SQLFetchScroll in ODBC 3.x. |
SQLSetPos |
ODBC |
Sets the cursor position in a rowset and enables an application to refresh data in a rowset or to update or delete data in a result set. |
SQLBulkOperations |
ODBC |
Performs bulk insertions and bulk bookmark operations, including update, delete, and fetch by bookmark. |
SQLError |
Deprecated |
Returns error or status information. |
SQLGetDiagField |
ISO 92 |
Returns the value of a single field of a diagnostic record that contains error, warning, or status information. |
SQLGetDiagRec |
ISO 92 |
Returns the values of multiple fields of a diagnostic record that contains error, warning, or status information. |
SQLColumnPrivileges |
ODBC |
Returns a list of columns and associated privileges for the table. |
SQLColumns |
Open Group |
Returns a list of column names in specified tables. |
SQLForeignKeys |
ODBC |
Returns a list of foreign keys in the table or a list of foreign keys in other tables that refer to the specified table. |
SQLPrimaryKeys |
ODBC |
Returns the column names that make up the primary key for the table. |
SQLProcedureColumns |
ODBC |
Returns a list of input and output parameters, the return value, and the columns in a result set of a stored procedure. |
SQLProcedures |
ODBC |
Returns a list of procedure names stored in the data source. |
SQLSpecialColumns |
Open Group |
Returns information about the optimal set of columns that uniquely identifies a row in the table, or the columns that are automatically updated when any value in the row is updated by a transaction. |
SQLStatistics |
ISO 92 |
Returns statistics about the table and a list of indexes associated with the table. |
SQLTablePrivileges |
ODBC |
Returns a list of tables and the privileges associated with each table. |
SQLTables |
Open Group |
Returns a list of table, catalog, or schema names, and table types stored in the data source. |
SQLTransact |
Deprecated |
Manages transactions. This function was replaced by SQLEndTran in ODBC 3.x. |
SQLEndTran |
ISO 92 |
Commits or rolls back a transaction for a single connection or for all connections associated with an environment. |
Terminating statement processing
SQLFreeStmt |
ISO 92 |
Ends statement processing, closes any open cursors associated with the statement, discards pending results, or, optionally, frees all resources associated with the statement handle. |
SQLCloseCursor |
ISO 92 |
Closes a cursor that has been opened on a statement and discards pending results. |
SQLCancel |
ISO 92 |
Cancels the processing on a statement. |
Closing a connection
SQLDisconnect |
ISO 92 |
Closes a connection. |
SQLFreeHandle |
ISO 92 |
Releases resources associated with a specific environment, connection, statement, or descriptor handle. |
SQLFreeConnect |
Deprecated |
Releases resources associated with a specific connection handle. This function was replaced by SQLFreeHandle in ODBC 3.x. |
SQLFreeEnv |
Deprecated |
Releases resources associated with a specific environment handle. This function was replaced by SQLFreeHandle in ODBC 3.x. |