MDAC 2.5 SDK - ODBC Programmer's Reference
Chapter 6: Connecting to a Data Source or Driver


 

Declaring the Application's ODBC Version

Before an application allocates a connection, it must set the SQL_ATTR_ODBC_VERSION environment attribute. This attribute states that the application follows the ODBC 2.x or ODBC 3.x specification when using the following items:

The ODBC 3.x Driver Manager and ODBC 3.x drivers check the version of the ODBC specification to which an application is written and respond accordingly. For example, if the application follows the ODBC 2.x specification and calls SQLExecute before calling SQLPrepare, the ODBC 3.x Driver Manager returns SQLSTATE S1010 (Function sequence error). If the application follows the ODBC 3.x specification, the Driver Manager returns SQLSTATE HY010 (Function sequence error). For more information, see "Backward Compatibility and Standards Compliance" in Chapter 17, "Programming Considerations."

Important   Applications that follow the ODBC 3.x specification must use conditional code to avoid using functionality new to ODBC 3.x when working with ODBC 2.x drivers. ODBC 2.x drivers do not support functionality new to ODBC 3.x just because the application declares that it follows the ODBC 3.x specification. Furthermore, ODBC 3.x drivers do not cease to support functionality new to ODBC 3.x just because the application declares that it follows the ODBC 2.x specification.