Bypass ODBC parsing
You can bypass ODBC parsing by using several options.
Sometimes you might want to improve performance by bypassing
ODBC parsing. Do not bypass ODBC parsing if these conditions exist:
- You intend to use ODBC escape sequences in your query.
- You intend to call any catalog functions (for example, SQLColumns, SQLProcedureColumns, or SQLTables) after running your SQL query.
You can bypass ODBC parsing in the following ways:
- Set SKIPPARSING to 1 in the connection string. The connection
string is used in a SQLDriverConnect call. For example:
connString="DB=xxx;UID=xxx;....;SKIPPARSING=1;"
- Include SQL_INFX_ATTR_SKIP_PARSING in a SQLSetConnectAttr call,
for example:
SQLSetConnectAttr (hdbc, SQL_INFX_ATTR_SKIP_PARSING, (SQLPOINTER)SQL_TRUE, SQL_IS_USMALLINT);
Use this call after the connection is completed. To restore ODBC parsing, change SQL_TRUE to SQL_FALSE. After this value is enabled at the connection level, all statement handles that are allocated with the connection inherit this property.
- In a SQLSetStmtAttr call, include SQL_TRUE. To restore ODBC parsing,
change SQL_TRUE to SQL_FALSE.
SQLSetStmtAttr (hstmt, SQL_INFX_ATTR_SKIP_PARSING, (SQLPOINTER)SQL_TRUE, SQL_IS_USMALLINT);
- On UNIX™ systems, in .odbc.ini set
SKIPPARSING=1
. To restore ODBC parsing, reset the value toSKIPPARSING=0
.
The precedence of bypassing ODBC parsing is as follows:
- If ODBC parsing is bypassed or reset in the odbc.ini file (on UNIX™ systems) and also in the application with the SQLDriverConnect, SQLSetConnectAttr, or the SQLSetStmtAttr APIs, the API setting takes precedence.
- If ODBC parsing is bypassed or reset in the application with the SQLDriverConnect API and also in the SQLSetConnectAttr or SQLSetStmtAttr APIs, the latter takes precedence.