Programmer Guide : solidDB® ODBC API : ODBC handle validation
  
ODBC handle validation
You can control ODBC handle validation with the client-side Client.ODBCHandleValidation parameter or dynamically with the non-standard ODBC attribute SQL_ATTR_HANDLE_VALIDATION. For performance reasons, ODBC handle validation in solidDB® is switched off by default.
For example, in Windows environments with ODBC driver manager, the driver manager performs the handle validation and the solidDB® ODBC driver does not need to repeat the same validation procedures. Also, a carefully written ODBC application does not normally cause invalid handles to be used; in such a case, the handle validation in the ODBC driver is not needed. In both cases, the applications can benefit from performance improvements when skipping the handle validation in the driver.
To switch ODBC handle validation on or off:
Set the client-side Client.ODBCHandleValidation to yes or no. Default is no.
[Client]
ODBCHandleValidation=yes
or
Set the non-standard environment attribute SQL_ATTR_HANDLE_VALIDATION to 1 (on) or 0 (off). Default is 0.
– To switch handle validation on:
SQLSetEnvAttr(henv, SQL_ATTR_HANDLE_VALIDATION,
  (SQLPOINTER)1, 0);
– To switch handle validation off:
SQLSetEnvAttr(henv, SQL_ATTR_HANDLE_VALIDATION,
  (SQLPOINTER)0, 0);
Important: The SQL_ATTR_HANDLE_VALIDATION attribute must be set after creating the environment handle but before any other handle is created. The SQL_ATTR_HANDLE_VALIDATION attribute is global; when set, it affects all the solidDB® ODBC handles initiated by the application. This ensures consistency by preventing the application from allocating both validated and non-validated handles.
When the handle validation is switched on, any ODBC function may fail with the standard return value SQL_INVALID_HANDLE.
If handle validation is turned off and invalid handle is used by the application, the ODBC driver behavior is unpredictable and most likely causes the application to crash.
Related concepts
solidDB® extensions for ODBC API
Related reference
Client-side configuration parameters
See also
solidDB® ODBC API