ODBC Attributes and Corresponding OLE DB Properties

OLE DB and ODBC are different interfaces. A one-to-one correspondence between the properties of one interface and the attributes of the other does not exist. OLE DB contains a rich definition of property sets and interface method parameters that provide services significantly different from those provided by ODBC. For more information, see the OLE DB documentation of schema rowsets, property sets, and methods.

The following tables show ODBC attributes and their OLE DB property equivalents. Where a one-to-one mapping cannot be made easily, the OLE DB property set and property columns are left blank.

Column Attributes

ODBC developers use SQLDescribeCol, SQLColAttribute, or SQLGetDescField to retrieve a given attribute. The interfaces and retrieval methods in OLE DB are also shown.

ODBC attribute OLE DB property set, schema rowset, or method OLE DB property
SQL_DESC_AUTO_

UNIQUE_VALUE

IColumnsRowset::GetColumnsRowset DBCOLUMN_

ISAUTOINCREMENT

SQL_DESC_BASE_

COLUMN_NAME

IColumnsRowset::GetColumnsRowset DBCOLUMN_

BASECOLUMNNAME

SQL_DESC_BASE_

TABLE_NAME

IColumnsRowset::GetColumnsRowset DBCOLUMN_

BASETABLENAME

SQL_DESC_CASE_

SENSITIVE

IColumnsRowset::GetColumnsRowset DBCOLUMN_

ISCASESENSITIVE

SQL_DESC_CATALOG_

NAME

IColumnsRowset::GetColumnsRowset DBCOLUMN_

BASECATALOGNAME

SQL_DESC_CONCISE_

TYPE

SQL_DESC_COUNT IColumnsInfo::GetColumnInfo The value returned in the pcColumns argument
SQL_DESC_DISPLAY_SIZE
SQL_DESC_FIXED_

PREC_SCALE

IDBSchemaRowset::GetRowset DBSCHEMA_PROVIDER_TYPES rowset restricted by DBCOLUMN_TYPE property from IColumnsRowset::GetColumnsRowset FIXED_PREC_SCALE column
SQL_DESC_LABEL IColumnsRowset::GetColumnsRowset DBCOLUMN_NAME
SQL_DESC_LENGTH IColumnsInfo::GetColumnInfo Derived from ulColumnSize
SQL_DESC_NAME IColumnsRowset::GetColumnsRowset DBCOLUMN_NAME
SQL_DESC_NULLABLE IColumnsRowset::GetColumnsRowset

IColumnsInfo::GetColumnInfo

DBCOLUMN_FLAGS or dwFlags flag DBCOLUMNFLAGS_

ISNULLABLE

SQL_DESC_NUM_PREX_

RADIX

SQL_DESC_OCTET_

LENGTH

IColumnsRowset::GetColumnsRowset DBCOLUMN_

OCTETLENGTH

SQL_DESC_PRECISION IColumnsRowset::GetColumnsRowset

IColumnsInfo::GetColumnInfo

DBCOLUMN_

PRECISION or bPrecision

SQL_DESC_SCALE IColumnsRowset::GetColumnsRowset

IColumnsInfo::GetColumnInfo

DBCOLUMN_SCALE or bScale
SQL_DESC_SCHEMA_

NAME

IColumnsRowset::GetColumnsRowset DBCOLUMN_

BASESCHEMANAME

SQL_DESC_SEARCHABLE IColumnsRowset::GetColumnsRowset DBCOLUMN_

ISSEARCHABLE

SQL_DESC_TABLE_NAME IColumnsRowset::GetColumnsRowset DBCOLUMN_

BASETABLENAME

SQL_DESC_TYPE IColumnsRowset::GetColumnsRowset

IColumnsInfo::GetColumnInfo

DBCOLUMN_TYPE or wType
SQL_DESC_TYPE_NAME IDBSchemaRowset::GetRowset DBSCHEMA_PROVIDER_TYPES rowset restricted by DBCOLUMN_TYPE property from IColumnsRowset::GetColumnsRowset TYPE_NAME column
SQL_DESC_UNNAMED
SQL_DESC_UNSIGNED IDBSchemaRowset::GetRowset DBSCHEMA_PROVIDER_TYPES rowset restricted by DBCOLUMN_TYPE property from IColumnsRowset::GetColumnsRowset UNSIGNED_

ATTRIBUTE column

SQL_DESC_UPDATABLE IColumnsRowset::GetColumnsRowset

IColumnsInfo::GetColumnInfo

DBCOLUMN_FLAGS or dwFlags flag DBCOLUMNFLAGS_

WRITE


Connection Attributes

ODBC connection attributes that control the behavior of the ODBC drivers, such as SQL_ATTR_ASYNC_ENABLE, are not included. OLE DB database and schema properties are indicated.

ODBC attribute

OLE DB property set, schema rowset, or method

OLE DB property or flag

SQL_ATTR_ACCESS_MODE IDBProperties::SetProperties DBPROP_

DATASOURCEREADONLY

SQL_ATTR_AUTOCOMMIT Autocommit mode is on if the session is outside of a transaction
SQL_ATTR_CONNECTION_

TIMEOUT

SQL_ATTR_CURRENT_

CATALOG

IDBProperties::SetProperties DBPROP_

CURRENTCATALOG

SQL_ATTR_LOGIN_

TIMEOUT

IDBProperties::SetProperties DBPROP_INIT_TIMEOUT
SQL_ATTR_QUIET_MODE IDBProperties::SetProperties DBPROP_INIT_HWND
SQL_ATTR_TXN_

ISOLATION

ITransactionLocal::StartTransaction isoLevel

Statement Attributes

OLE DB command properties and rowset methods are indicated.

ODBC statement attributes that control driver behaviors, such as SQL_ATTR_NOSCAN, are not included in the table. Statement attributes that are used to set bound parameter and column behaviors are also not included. OLE DB uses the DBBINDING structure together with data accessors to control arrays of parameters and bound columns. For more information, see "Getting and Setting Data" in the OLE DB documentation.

ODBC attribute

OLE DB property set, schema rowset, or method

OLE DB property or flag

SQL_ATTR_ASYNC_

ENABLE

Multiple concurrent operations are performed by different threads
SQL_ATTR_

CONCURRENCY

ITransactionLocal::StartTransaction

ISessionProperties::SetProperties

DBPROPSET_SESSION

isoLevel value for the StartTransaction interface, DBPROP_SESS_

AUTOCOMMIT_ISOLEVELS when set for auto commit mode on the session

SQL_ATTR_CURSOR_

SCROLLABLE

ICommandProperties::SetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS

SQL_ATTR_CURSOR_

SENSITIVITY

ICommandProperties::SetProperties

DBPROPSET_ROWSET

DBPROP_OTHERINSERT and DBPROP_

OTHERUPDATEDELETE

SQL_ATTR_CURSOR_

TYPE

ICommandProperties::SetProperties

DBPROPSET_ROWSET

DBPROP_CANSCROLL-BACKWARDS, DBPROP_OTHER-INSERT, and DBPROP_

OTHERUPDATEDELETE

SQL_ATTR_KEYSET_

SIZE

SQL_ATTR_MAX_

LENGTH

SQL_ATTR_MAX_ROWS ICommandProperties::SetProperties

DBPROPSET_ROWSET

DBPROP_MAXROWS
SQL_ATTR_QUERY_

TIMEOUT

ICommandProperties::SetProperties

DBPROPSET_ROWSET

DBPROP_

COMMANDTIMEOUT

SQL_ATTR_RETRIEVE_

DATA

IRowset::GetData Data is not retrieved until GetData method is called on the rowset
SQL_ATTR_ROW_

ARRAY_SIZE

IRowset::GetNextRows cRows value
SQL_ATTR_ROW_

NUMBER


SQLGetInfo

SQLGetInfo returns information about a specific ODBC data source. OLE DB offers provider property sets and other entry points to expose provider-specific behaviors.

OLE DB allows providers to define additional property sets. For example, the ODBC provider shipped with the OLE DB SDK defines the DBPROPSET_PROVIDERROWSET and DBPROPSET_PROVIDERDATASOURCEINFO property sets, and some SQLGetInfo InfoType parameters are supported through these provider-specific property sets.

In the following table, SQLGetInfo InfoType parameters that have no meaning in OLE DB have been eliminated (for example, SQL_DM_VER, which returns the ODBC Driver Manager version number).

Where a one-to-one match does not exist, a tip is provided to help you discover the information. For example, SQLGetInfo InfoType SQL_ALTER_DOMAIN has no direct support in OLE DB. However, you can use the provider's IDBInfo::GetKeywords method to determine whether or not the provider recognizes the SQL ALTER statement.

SQLGetInfo InfoType value

OLE DB property set, schema rowset, or method

OLE DB property or flag

SQL_ACCESSIBLE_

PROCEDURES

SQL_ACCESSIBLE_TABLES
SQL_ACTIVE_

ENVIRONMENTS

SQL_AGGREGATE_

FUNCTIONS

IDBInfo::GetKeywords
SQL_ALTER_DOMAIN IDBInfo::GetKeywords
SQL_ALTER_TABLE IDBInfo::GetKeywords
SQL_ASYNC_MODE
SQL_BATCH_ROW_

COUNT

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

MULTIPLEPARAMSETS

SQL_BATCH_SUPPORT
SQL_BOOKMARK_

PERSISTENCE

Bookmarks are valid for the lifetime of the rowset to which they apply
SQL_CATALOG_LOCATION IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

CATALOGLOCATION

SQL_CATALOG_NAME IDBInfo::GetLiteralInfo DBLITERAL_CATALOG_

NAME

SQL_CATALOG_NAME_

SEPARATOR

IDBInfo::GetLiteralInfo DBLITERAL_CATALOG_

SEPARATOR

SQL_CATALOG_TERM IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_CATALOGTERM
SQL_CATALOG_USAGE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_CATALOGUSAGE
SQL_COLLATION_SEQ IDBSchemaRowset::GetRowset

COLLATIONS

COLLATION_NAME column
SQL_COLUMN_ALIAS
SQL_CONCAT_NULL_

BEHAVIOR

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

CONCATNULLBEHAVIOR

SQL_CONVERT (all types) IConvertType::CanConvertType
SQL_CONVERT_

FUNCTIONS

IDBInfo::GetKeywords
SQL_CORRELATION_NAME
SQL_CREATE_ASSERTION IDBInfo::GetKeywords
SQL_CREATE_

CHARACTER_SET

IDBInfo::GetKeywords
SQL_CREATE_COLLATION IDBInfo::GetKeywords
SQL_CREATE_DOMAIN IDBInfo::GetKeywords
SQL_CREATE_SCHEMA IDBInfo::GetKeywords
SQL_CREATE_TABLE IDBInfo::GetKeywords
SQL_CREATE_

TRANSLATION

IDBInfo::GetKeywords
SQL_CREATE_VIEW IDBInfo::GetKeywords
SQL_CURSOR_COMMIT_

BEHAVIOR

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_PREPARE-COMMITBEHAVIOR

DBPROP_

COMMITPRESERVE

SQL_CURSOR_ROLLBACK_

BEHAVIOR

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_PREPARE-ABORTTBEHAVIOR

DBPROP_

ABORTPRESERVE

SQL_CURSOR_SENSITIVITY
SQL_DATA_SOURCE_NAME IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

DATASOURCENAME

SQL_DATA_SOURCE_

READ_ONLY

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

DATASOURCEREADONLY

SQL_DATABASE_NAME IDBProperties::GetProperties

DBPROPSET_DATASOURCE

DBPROP_

CURRENTCATALOG

SQL_DATETIME_LITERALS
SQL_DBMS_NAME IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_DBMSNAME
SQL_DBMS_VER IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_DBMSVER
SQL_DDL_INDEX IDBInfo::GetKeywords
SQL_DEFAULT_TXN_

ISOLATION

Transaction isolation is explicitly specified
SQL_DESCRIBE_

PARAMETER

SQL_DRIVER_NAME IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_PROVIDERNAME
SQL_DRIVER_ODBC_VER IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

PROVIDEROLEDBVER

SQL_DRIVER_VER IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_PROVIDERVER
SQL_DROP_ASSERTION IDBInfo::GetKeywords
SQL_DROP_CHARACTER_

SET

IDBInfo::GetKeywords
SQL_DROP_COLLATION IDBInfo::GetKeywords
SQL_DROP_DOMAIN IDBInfo::GetKeywords
SQL_DROP_SCHEMA IDBInfo::GetKeywords
SQL_DROP_TABLE IDBInfo::GetKeywords
SQL_DROP_TRANSLATION IDBInfo::GetKeywords
SQL_DROP_VIEW IDBInfo::GetKeywords
SQL_DYNAMIC_CURSOR_

ATTRIBUTES1

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OTHERINSERT, DBPROP_

OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_DYNAMIC_CURSOR_

ATTRIBUTES2

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OTHERINSERT, DBPROP_

OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_EXPRESSIONS_IN_

ORDERBY

SQL_FETCH_DIRECTION ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS

SQL_FILE_USAGE
SQL_FORWARD_ONLY_

CURSOR_ATTRIBUTES1

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_OTHERINSERT, DBPROP_

OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_FORWARD_ONLY_

CURSOR_ATTRIBUTES2

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_OTHERINSERT, DBPROP_

OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_GETDATA_

EXTENSIONS

SQL_GROUP_BY IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_GROUPBY
SQL_IDENTIFIER_CASE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_IDENTIFIERCASE
SQL_IDENTIFIER_QUOTE_

CHAR

IDBInfo::GetLiteralInfo DBLITERAL_QUOTE
SQL_INDEX_KEYWORDS IDBInfo::GetKeywords
SQL_INFO_SCHEMA_VIEWS
SQL_INSERT_STATEMENT
SQL_INTEGRITY
SQL_KEYSET_CURSOR_

ATTRIBUTES1

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_KEYSET_CURSOR_

ATTRIBUTES2

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_KEYWORDS IDBInfo::GetKeywords
SQL_LIKE_ESCAPE_

CLAUSE

IDBInfo::GetLiteralInfo DBLITERAL_ESCAPE_

PERCENT, DBLITERAL_

ESCAPE_UNDERSCORE

SQL_MAX_ASYNC_

CONCURRENT_

STATEMENTS

SQL_MAX_BINARY_

LITERAL_LEN

IDBInfo::GetLiteralInfo DBLITERAL_BINARY_

LITERAL

SQL_MAX_CATALOG_

NAME_LEN

IDBInfo::GetLiteralInfo DBLITERAL_CATALOG_

NAME

SQL_MAX_CHAR_

LITERAL_LEN

IDBInfo::GetLiteralInfo DBLITERAL_CHAR_LITERAL
SQL_MAX_COLUMN_

NAME_LEN

IDBInfo::GetLiteralInfo DBLITERAL_COLUMN_

NAME

SQL_MAX_COLUMNS_

IN_GROUP_BY

SQL_MAX_COLUMNS_

IN_INDEX

SQL_MAX_COLUMNS_

IN_ORDER_BY

SQL_MAX_COLUMNS_

IN_SELECT

SQL_MAX_COLUMNS_

IN_TABLE

SQL_MAX_CONCURRENT_

ACTIVITIES

SQL_MAX_CURSOR_NAME_

LEN

SQL_MAX_DRIVER_

CONNECTIONS

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_ACTIVESESSIONS
SQL_MAX_IDENTIFIER_

LEN

SQL_MAX_INDEX_SIZE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_MAXINDEXSIZE
SQL_MAX_PROCEDURE_

NAME_LEN

IDBInfo::GetLiteralInfo DBLITERAL_PROCEDURE_

NAME

SQL_MAX_ROW_SIZE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_MAXROWSIZE
SQL_MAX_ROW_SIZE_

INCLUDES_LONG

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

MAXROWSIZEINCLUDES-BLOB

SQL_MAX_STATEMENT_

LEN

IDBInfo::GetLiteralInfo DBLITERAL_TEXT_

COMMAND

SQL_MAX_TABLE_NAME_

LEN

IDBInfo::GetLiteralInfo DBLITERAL_TABLE_NAME
SQL_MAX_TABLES_IN_

SELECT

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

MAXTABLESINSELECT

SQL_MAX_USER_NAME_

LEN

IDBInfo::GetLiteralInfo DBLITERAL_USER_NAME
SQL_MULT_RESULT_SETS IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

MULTIPLERESULTS

SQL_MULTIPLE_ACTIVE_

TXN

Provider is responsible for spawning connections, if necessary, to provide multiple transactions from one DSO
SQL_NEED_LONG_DATA_

LEN

SQL_NON_NULLABLE_

COLUMNS

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

COLUMNDEFINITION

SQL_NULL_COLLATION IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_NULLCOLLATION
SQL_NUMERIC_FUNCTIONS
SQL_OJ_CAPABILITIES
SQL_ORDER_BY_

COLUMNS_IN_SELECT

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

ORDERBYCOLUMNSIN-SELECT

SQL_OUTER_JOINS
SQL_OWNER_TERM IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_SCHEMATERM
SQL_OWNER_USAGE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_SCHEMAUSAGE
SQL_PARAM_ARRAY_

ROW_COUNTS

SQL_PARAM_ARRAY_

SELECTS

SQL_PROCEDURE_TERM IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

PROCEDURETERM

SQL_PROCEDURES IDBSchemaRowset::GetSchemas returns GUID for PROCEDURES schema rowset
SQL_QUOTED_IDENTIFIER_

CASE

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

QUOTEDIDENTIFIERCASE

SQL_ROW_UPDATES ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_IRowsetResynch
SQL_SCHEMA_TERM IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_SCHEMATERM
SQL_SCHEMA_USAGE IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_SCHEMAUSAGE
SQL_SCROLL_OPTIONS ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OTHERINSERT, DBPROP_

OTHERUPDATEDELETE, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_SEARCH_PATTERN_

ESCAPE

SQL_SERVER_NAME IDBProperties::GetProperties

DBPROPSET_INIT

DBPROP_INIT_LOCATION
SQL_SPECIAL_

CHARACTERS

IDBInfo::GetLiteralInfo Value of pwszInvalidChars when inquiring about identifiers, and so on
SQL_STATIC_CURSOR_

ATTRIBUTES1

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_STATIC_CURSOR_

ATTRIBUTES2

ICommandProperties::

GetProperties

DBPROPSET_ROWSET

DBPROP_

CANSCROLLBACKWARDS, DBPROP_OWNINSERT, DBPROP_

OWNUPDATEDELETE

SQL_STRING_FUNCTIONS
SQL_SUBQUERIES IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_SUBQUERIES
SQL_SYSTEM_FUNCTIONS
SQL_TABLE_TERM IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_TABLETERM
SQL_TIMEDATE_ADD_

INTERVALS

SQL_TIMEDATE_DIFF_

INTERVALS

SQL_TIMEDATE_

FUNCTIONS

SQL_TXN_CAPABLE IUnknown::QueryInterface on session for IID_ITransactionLocal
SQL_TXN_ISOLATION_

OPTION

IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_

SUPPORTED-TXNISORETAIN

SQL_UNION
SQL_USER_NAME IDBProperties::GetProperties

DBPROPSET_DATASOURCEINFO

DBPROP_USERNAME

The following interfaces also support setting and getting of property information: