Call Level Interface Guide and Reference

SQLGetInfo - Get General Information

Purpose


Specification: DB2 CLI 1.1 ODBC 1.0 ISO CLI

SQLGetInfo() returns general information, (including supported data conversions) about the DBMS that the application is currently connected to.

Syntax

SQLRETURN   SQLGetInfo       (
                SQLHDBC           ConnectionHandle,  /* hdbc */
                SQLUSMALLINT      InfoType,          /* fInfoType */
                SQLPOINTER        InfoValuePtr,      /* rgbInfoValue */
                SQLSMALLINT       BufferLength,      /* cbInfoValueMax */
                SQLSMALLINT  *FAR StringLengthPtr);  /* pcbInfoValue */

Function Arguments

Table 111. SQLGetInfo Arguments
Data Type Argument Use Description
SQLHDBC ConnectionHandle input Database connection handle
SQLUSMALLINT InfoType input The type of information desired. The argument must be one of the values in the first column of the tables in Data Types and Data Conversion.
SQLPOINTER InfoValuePtr output (also input) Pointer to buffer where this function will store the desired information. Depending on the type of information being retrieved, 5 types of information can be returned:
  • 16 bit integer value
  • 32 bit integer value
  • 32 bit binary value
  • 32 bit mask
  • null-terminated character string
SQLSMALLINT BufferLength input Maximum length of the buffer pointed by InfoValuePtr pointer.
SQLSMALLINT * StringLengthPtr output Pointer to location where this function will return the total number of bytes available to return the desired information. In the case of string output, this size does not include the null terminating character.

If the value in the location pointed to by StringLengthPtr is greater than the size of the InfoValuePtr buffer as specified in BufferLength, then the string output information would be truncated to BufferLength - 1 bytes and the function would return with SQL_SUCCESS_WITH_INFO.

Usage

Refer to Information Returned By SQLGetInfo for a list of the possible values of InfoType and a description of the information that SQLGetInfo() would return for that value.

A number of information types were renamed for DB2 CLI version 5. See Changes to the InfoTypes in SQLGetInfo() for the list. Information Returned By SQLGetInfo lists both the old value and the new value.

Information Returned By SQLGetInfo

Note:DB2 CLI returns a value for each InfoType in this table. If the InfoType does not apply or is not supported, the result is dependent on the return type. If the return type is a:
  • Character string containing 'Y' or 'N', "N" is returned.
  • Character string containing a value other than just 'Y' or 'N', an empty string is returned.
  • 16-bit integer, 0 (zero).
  • 32-bit integer, 0 (zero).
  • 32-bit mask, 0 (zero).

SQL_ACCESSIBLE_PROCEDURES (string)
A character string of "Y" indicates that the user can execute all procedures returned by the function SQLProcedures(). "N" indicates there may be procedures returned that the user cannot execute.

SQL_ACCESSIBLE_TABLES (string)
A character string of "Y" indicates that the user is guaranteed SELECT privilege to all tables returned by the function SQLTables(). "N" indicates that there may be tables returned that the user cannot access.

SQL_ACTIVE_ENVIRONMENTS (16-bit integer)
This InfoType has been replaced with SQL_MAX_CONCURRENT_ACTIVITIES.

The maximum number of active environments that the DB2 CLI driver can support. If there is no specified limit or the limit is unknown, this value is set to zero.

SQL_AGGREGATE_FUNCTIONS (32-bit mask)
A bitmask enumerating support for aggregation functions:

SQL_ALTER_DOMAIN (32-bit mask)
DB2 CLI returns 0 indicating that the ALTER DOMAIN statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_ACTIVE_CONNECTIONS (16-bit integer)
This InfoType has been replaced with SQL_MAX_DRIVER_CONNECTIONS.

The maximum number of active connections supported per application.

Zero is returned, indicating that the limit is dependent on system resources.

The MAXCONN keyword in the db2cli.ini initialization file or the SQL_ATTR_MAX_CONNECTIONS environment/connection option can be used to impose a limit on the number of connections. This limit is returned if it is set to any value other than zero.

SQL_ACTIVE_STATEMENTS (16-bit integer)
This InfoType has been replaced with SQL_MAX_CONCURRENT_ACTIVITIES.

The maximum number of active statements per connection.

Zero is returned, indicating that the limit is dependent on database system and DB2 CLI resources, and limits.

SQL_ALTER_TABLE (32-bit mask)
Indicates which clauses in the ALTER TABLE statement are supported by the DBMS.

SQL_ASYNC_MODE (32-bit unsigned integer)
Indicates the level of asynchronous support:

SQL_BATCH_ROW_COUNT (32-bit mask)
Indicates how row counts are dealt with. DB2 CLI always returns SQL_BRC_ROLLED_UP indicating that row counts for consecutive INSERT, DELETE, or UPDATE statements are rolled up into one.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_BATCH_SUPPORT (32-bit mask)
Indicates which level of batches are supported:

SQL_BOOKMARK_PERSISTENCE (32-bit mask)
Indicates when bookmarks remain valid after an operation:

SQL_CATALOG_LOCATION (16-bit integer)
A 16-bit integer value indicated the position of the qualifier in a qualified table name. DB2 CLI always returns SQL_CL_START for this information type. ODBC also defines the value SQL_CL_END which is not returned by DB2 CLI.

In previous versions of DB2 CLI this InfoType was SQL_QUALIFIER_LOCATION.

SQL_CATALOG_NAME (string)
A character string of "Y" indicates that the server supports catalog names. "N" indicates that catalog names are not supported.

SQL_CATALOG_NAME_SEPARATOR (string)
The character(s) used as a separator between a catalog name and the qualified name element that follows it.

In previous versions of DB2 CLI this InfoType was SQL_QUALIFIER_NAME_SEPARATOR.

SQL_CATALOG_TERM (string)
The database vendor's terminology for a qualifier

The name that the vendor uses for the high order part of a three part name.

Since DB2 CLI does not support three part names, a zero-length string is returned.

In previous versions of DB2 CLI this InfoType was SQL_QUALIFIER_TERM.

SQL_CATALOG_USAGE (32-bit mask)
This is similar to SQL_OWNER_USAGE except that this is used for catalog.

In previous versions of DB2 CLI this InfoType was SQL_QUALIFIER_USAGE.

SQL_COLLATION_SEQ (string)
The name of the collation sequence. This is a character string that indicates the name of the default collation for the default character set for this server (for example ISO 8859-1 or EBCDIC). If this is unknown, an empty string will be returned.

SQL_COLUMN_ALIAS (string)
Returns "Y" if column aliases are supported, or "N" if they are not.

SQL_CONCAT_NULL_BEHAVIOR (16-bit integer)
Indicates how the concatenation of NULL valued character data type columns with non-NULL valued character data type columns is handled.


SQL_CONVERT_BIGINT
SQL_CONVERT_BINARY
SQL_CONVERT_BIT
SQL_CONVERT_CHAR
SQL_CONVERT_DATE
SQL_CONVERT_DECIMAL
SQL_CONVERT_DOUBLE
SQL_CONVERT_FLOAT
SQL_CONVERT_INTEGER
SQL_CONVERT_INTERVAL_YEAR_MONTH
SQL_CONVERT_INTERVAL_DAY_TIME
SQL_CONVERT_LONGVARBINARY
SQL_CONVERT_LONGVARCHAR
SQL_CONVERT_NUMERIC
SQL_CONVERT_REAL
SQL_CONVERT_SMALLINT
SQL_CONVERT_TIME
SQL_CONVERT_TIMESTAMP
SQL_CONVERT_TINYINT
SQL_CONVERT_VARBINARY
SQL_CONVERT_VARCHAR

(all above are 32-bit masks)
Indicates the conversions supported by the data source with the CONVERT scalar function for data of the type named in the InfoType. If the bitmask equals zero, the data source does not support any conversions for the data of the named type, including conversions to the same data type.

For example, to find out if a data source supports the conversion of SQL_INTEGER data to the SQL_DECIMAL data type, an application calls SQLGetInfo() with InfoType of SQL_CONVERT_INTEGER. The application then ANDs the returned bitmask with SQL_CVT_DECIMAL. If the resulting value is nonzero then the conversion is supported.

The following bitmasks are used to determine which conversions are supported:

SQL_CONVERT_FUNCTIONS (32-bit mask)
Indicates the scalar conversion functions supported by the driver and associated data source.

DB2 CLI Version 2.1.1 and later supports ODBC scalar conversions between char variables (CHAR, VARCHAR, LONG VARCHAR and CLOB) and DOUBLE (or FLOAT).

SQL_CORRELATION_NAME (16-bit integer)
Indicates the degree of correlation name support by the server:

SQL_CREATE_ASSERTION (32-bit mask)
Indicates which clauses in the CREATE ASSERTION statement are supported by the DBMS. DB2 CLI always returns zero; the CREATE ASSERTION statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_CREATE_CHARACTER_SET (32-bit mask)
Indicates which clauses in the CREATE CHARACTER SET statement are supported by the DBMS. DB2 CLI always returns zero; the CREATE CHARACTER SET statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_CREATE_COLLATION (32-bit mask)
Indicates which clauses in the CREATE COLATION statement are supported by the DBMS. DB2 CLI always returns zero; the CREATE COLLATION statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_CREATE_DOMAIN (32-bit mask)
Indicates which clauses in the CREATE DOMAIN statement are supported by the DBMS. DB2 CLI always returns zero; the CREATE DOMAIN statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_CREATE_SCHEMA (32-bit mask)
Indicates which clauses in the CREATE SCHEMA statement are supported by the DBMS:

SQL_CREATE_TABLE (32-bit mask)
Indicates which clauses in the CREATE TABLE statement are supported by the DBMS.

The following bitmasks are used to determine which clauses are supported:

The following bits specify the ability to create temporary tables:

The following bits specify the ability to create column constraints:

The following bits specify the supported constraint attributes if specifying column or table constraints is supported:

SQL_CREATE_TRANSLATION (32-bit mask)
Indicates which clauses in the CREATE TRANSLATION statement are supported by the DBMS. DB2 CLI always returns zero; the CREATE TRANSLATION statement is not supported.

ODBC also defines the following value that is not returned by DB2 CLI:

SQL_CREATE_VIEW (32-bit mask)
Indicates which clauses in the CREATE VIEW statement are supported by the DBMS:

A return value of 0 means that the CREATE VIEW statement is not supported.

SQL_CURSOR_CLOSE_BEHAVIOR (32-bit unsigned integer)
Indicates whether or not locks are released when the cursor is closed. The possible values are:

Typically cursors are explicitly closed when the function SQLFreeStmt() is called with the SQL_CLOSE option or SQLFreeHandle() is called with HandleType set to SQL_HANDLE_STMT. In addition, the end of the transaction (when a commit or rollback is issued) may also cause the closing of the cursor (depending on the WITH HOLD attribute currently in use).

SQL_CURSOR_COMMIT_BEHAVIOR (16-bit integer)
Indicates how a COMMIT operation affects cursors. A value of:

SQL_CURSOR_ROLLBACK_BEHAVIOR (16-bit integer)
Indicates how a ROLLBACK operation affects cursors. A value of:

SQL_CURSOR_SENSITIVITY (32-bit unsigned integer)
Indicates support for cursor sensitivity:

SQL_DATA_SOURCE_NAME (string)
The name used as data source on the input to SQLConnect(), or the DSN keyword value in the SQLDriverConnect() connection string.

SQL_DATA_SOURCE_READ_ONLY (string)
A character string of "Y" indicates that the database is set to READ ONLY mode, "N" indicates that is not set to READ ONLY mode.

SQL_DATABASE_NAME (string)
The name of the current database in use
Note:also returned by SELECT CURRENT SERVER on IBM DBMS's.

SQL_DATETIME_LITERALS (32-bit unsigned integer)
Indicates the datetime literals that are supported by the DBMS. DB2 CLI always returns zero; datetime literals are not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_DBMS_NAME (string)
The name of the DBMS product being accessed

For example:

SQL_DBMS_VER (string)
The Version of the DBMS product accessed. A string of the form 'mm.vv.rrrr' where mm is the major version, vv is the minor version and rrrr is the release. For example, "0r.01.0000" translates to major version r, minor version 1, release 0.

SQL_DDL_INDEX (32-bit unsigned integer)
Indicates support for the creation and dropping of indexes:

SQL_DEFAULT_TXN_ISOLATION (32-bit mask)
The default transaction isolation level supported

One of the following masks are returned:

In IBM terminology,

SQL_DESCRIBE_PARAMETER (string)
"Y" if parameters can be described; "N" if not.

SQL_DM_VER (string)
Reserved.

SQL_DRIVER_HDBC (32 bits)
DB2 CLI's database handle

SQL_DRIVER_HDESC (32 bits)
DB2 CLI's descriptor handle

SQL_DRIVER_HENV (32 bits)
DB2 CLI's environment handle

SQL_DRIVER_HLIB (32 bits)
Reserved.

SQL_DRIVER_HSTMT (32 bits)
DB2 CLI's statement handle

In an ODBC environment with an ODBC Driver Manager, if InfoType is set to SQL_DRIVER_HSTMT, the Driver Manager statement handle (i.e. the one returned from SQLAllocStmt()) must be passed on input in rgbInfoValue from the application. In this case rgbInfoValue is both an input and an output argument. The ODBC Driver Manager is responsible for returning the mapped value. ODBC applications wishing to call DB2 CLI specific functions (such as the LOB functions) can access them, by passing these handle values to the functions after loading the DB2 CLI library and issuing an operating system call to invoke the desired functions.

SQL_DRIVER_NAME (string)
The file name of the DB2 CLI implementation.

SQL_DRIVER_ODBC_VER (string)
The version number of ODBC that the Driver supports. DB2 CLI will return "03.00".

SQL_DRIVER_VER (string)
The version of the CLI driver. A string of the form 'mm.vv.rrrr' where mm is the major version, vv is the minor version and rrrr is the release. For example, "05.01.0000" translates to major version 5, minor version 1, release 0.

SQL_DROP_ASSERTION (32-bit unsigned integer)
Indicates which clause in the DROP ASSERTION statement is supported by the DBMS. DB2 CLI always returns zero; the DROP ASSERTION statement is not supported.

ODBC also defines the following value that is not returned by DB2 CLI:

SQL_DROP_CHARACTER_SET (32-bit unsigned integer)
Indicates which clause in the DROP CHARACTER SET statement is supported by the DBMS. DB2 CLI always returns zero; the DROP CHARACTER SET statement is not supported.

ODBC also defines the following value that is not returned by DB2 CLI:

SQL_DROP_COLLATION (32-bit unsigned integer)
Indicates which clause in the DROP COLLATION statement is supported by the DBMS. DB2 CLI always returns zero; the DROP COLLATION statement is not supported.

ODBC also defines the following value that is not returned by DB2 CLI:

SQL_DROP_DOMAIN (32-bit unsigned integer)
Indicates which clauses in the DROP DOMAIN statement are supported by the DBMS. DB2 CLI always returns zero; the DROP DOMAIN statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_DROP_SCHEMA (32-bit unsigned integer)
Indicates which clauses in the DROP SCHEMA statement are supported by the DBMS. DB2 CLI always returns zero; the DROP SCHEMA statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_DROP_TABLE (32-bit unsigned integer)
Indicates which clauses in the DROP TABLE statement are supported by the DBMS:

SQL_DROP_TRANSLATION (32-bit unsigned integer)
Indicates which clauses in the DROP TRANSLATION statement are supported by the DBMS. DB2 CLI always returns zero; the DROP TRANSLATION statement is not supported.

ODBC also defines the following value that is not returned by DB2 CLI:

SQL_DROP_VIEW (32-bit unsigned integer)
Indicates which clauses in the DROP VIEW statement are supported by the DBMS. DB2 CLI always returns zero; the DROP VIEW statement is not supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_DTC_TRANSITION_COST (32-bit unsigned mask)
Used by Microsoft Transaction Server to determine whether or not the enlistment process for a connection is expensive. DB2 CLI returns:

SQL_DYNAMIC_CURSOR_ATTRIBUTES1 (32-bit mask)
Indicates the attributes of a dynamic cursor that are supported by DB2 CLI (subset 1 of 2).

SQL_DYNAMIC_CURSOR_ATTRIBUTES2 (32-bit mask)
Indicates the attributes of a dynamic cursor that are supported by DB2 CLI (subset 2 of 2).

SQL_EXPRESSIONS_IN_ORDERBY (string)
The character string "Y" indicates the database server supports the DIRECT specification of expressions in the ORDER BY list, "N" indicates that is does not.

SQL_FETCH_DIRECTION (32-bit mask)
The supported fetch directions.

The following bit-masks are used in conjunction with the flag to determine which options are supported.

SQL_FILE_USAGE (16-bit integer)
Indicates how a single-tier driver directly treats files in a data source. The DB2 CLI driver is not a single-tier driver and therefor always returns SQL_FILE_NOT_SUPPORTED.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 (32-bit mask)
Indicates the attributes of a forward-only cursor that are supported by DB2 CLI (subset 1 of 2).

SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 (32-bit mask)
Indicates the attributes of a forward-only cursor that are supported by DB2 CLI (subset 2 of 2).

SQL_GETDATA_EXTENSIONS (32-bit mask)
Indicates whether extensions to the SQLGetData() function are supported. The following extensions are currently identified and supported by DB2 CLI:

ODBC also defines the following extensions which are not returned by DB2 CLI:

SQL_GROUP_BY (16-bit integer)
Indicates the degree of support for the GROUP BY clause by the server:

SQL_IDENTIFIER_CASE (16-bit integer)
Indicates case sensitivity of object names (such as table-name).

A value of:

Note:Identifier names in IBM DBMSs are not case sensitive.

SQL_IDENTIFIER_QUOTE_CHAR (string)
Indicates the character used to surround a delimited identifier

SQL_INDEX_KEYWORDS (32-bit mask)
Indicates the keywords in the CREATE INDEX statement that are supported:

To see the the CREATE INDEX statement is supported, an application can call SQLGetInfo() with the SQL_DLL_INDEX InfoType.

SQL_INFO_SCHEMA_VIEWS (32-bit mask)
Indicates the views in the INFORMATIONAL_SCHEMA that are supported. DB2 CLI always returns zero; no views in the INFORMATIONAL_SCHEMA are supported.

ODBC also defines the following values that are not returned by DB2 CLI:

SQL_INSERT_STATEMENT (32-bit mask)
Indicates support for INSERT statements:

SQL_INTEGRITY (string)
The "Y" character string indicates that the data source supports Integrity Enhanced Facility (IEF) in SQL89 and in X/Open XPG4 Embedded SQL, an "N" indicates it does not.

In previous versions of DB2 CLI this InfoType was SQL_ODBC_SQL_OPT_IEF.

SQL_KEYSET_CURSOR_ATTRIBUTES1 (32-bit mask)
Indicates the attributes of a keyset cursor that are supported by DB2 CLI (subset 1 of 2).

SQL_KEYSET_CURSOR_ATTRIBUTES2 (32-bit mask)
Indicates the attributes of a keyset cursor that are supported by DB2 CLI (subset 2 of 2).

SQL_KEYWORDS (string)
This is a string of all the keywords at the DBMS that are not in the ODBC's list of reserved words.

SQL_LIKE_ESCAPE_CLAUSE (string)
A character string that indicates if an escape character is supported for the metacharacters percent and underscore in a LIKE predicate.

SQL_LOCK_TYPES (32-bit mask)
Reserved option, zero is returned for the bit-mask.

SQL_MAX_ASYNC_CONCURRENT_STATEMENTS (32-bit unsigned integer)
The maximum number of active concurrent statements in asynchronous mode that DB2 CLI can support on a given connection. This value is zero if there is no specific limit, or the limit is unknown.

SQL_MAX_BINARY_LITERAL_LEN (32-bit unsigned integer)
A 32-bit unsigned integer value specifying the maximum length of a hexadecimal literal in a SQL statement.

SQL_MAX_CATALOG_NAME_LEN (16-bit integer)
The maximum length of a catalog name in the data source. This value is zero if there is no maximum length, or the length is unknown.

In previous versions of DB2 CLI this fInfoType was SQL_MAX_QUALIFIER_NAME_LEN.

SQL_MAX_CHAR_LITERAL_LEN (32-bit unsigned integer)
The maximum length of a character literal in an SQL statement (in bytes).

SQL_MAX_COLUMN_NAME_LEN (16-bit integer)
The maximum length of a column name (in bytes)

SQL_MAX_COLUMNS_IN_GROUP_BY (16-bit integer)
Indicates the maximum number of columns that the server supports in a GROUP BY clause. Zero if no limit.

SQL_MAX_COLUMNS_IN_INDEX (16-bit integer)
Indicates the maximum number of columns that the server supports in an index. Zero if no limit.

SQL_MAX_COLUMNS_IN_ORDER_BY (16-bit integer)
Indicates the maximum number of columns that the server supports in an ORDER BY clause. Zero if no limit.

SQL_MAX_COLUMNS_IN_SELECT (16-bit integer)
Indicates the maximum number of columns that the server supports in a select list. Zero if no limit.

SQL_MAX_COLUMNS_IN_TABLE (16-bit integer)
Indicates the maximum number of columns that the server supports in a base table. Zero if no limit.

SQL_MAX_CONCURRENT_ACTIVITIES (16-bit integer)
The maximum number of active environments that the DB2 CLI driver can support. If there is no specified limit or the limit is unknown, this value is set to zero.

In previous versions of DB2 CLI this InfoType was SQL_ACTIVE_ENVIRONMENTS.

SQL_MAX_CURSOR_NAME_LEN (16-bit integer)
The maximum length of a cursor name (in bytes). This value is zero if there is no maximum length, or the length is unknown.

SQL_MAX_DRIVER_CONNECTIONS (16-bit integer)
The maximum number of active connections supported per application.

Zero is returned, indicating that the limit is dependent on system resources.

The MAXCONN keyword in the db2cli.ini initialization file or the SQL_ATTR_MAX_CONNECTIONS environment/connection option can be used to impose a limit on the number of connections. This limit is returned if it is set to any value other than zero.

In previous versions of DB2 CLI this InfoType was SQL_ACTIVE_CONNECTIONS.

SQL_MAX_IDENTIFIER_LEN (16-bit integer)
The maximum size (in characters) that the data source supports for user-defined names.

SQL_MAX_INDEX_SIZE (32-bit unsigned integer)
Indicates the maximum size in bytes that the server supports for the combined columns in an index. Zero if no limit.

SQL_MAX_OWNER_NAME_LEN (16-bit integer)
This fInfoType has been replaced with SQL_MAX_SCHEMA_NAME_LEN.

The maximum length of a schema qualifier name (in bytes).

SQL_MAX_PROCEDURE_NAME_LEN (16-bit integer)
The maximum length of a procedure name (in bytes).

SQL_MAX_QUALIFIER_NAME_LEN (16-bit integer)
This fInfoType has been replaced with SQL_MAX_CATALOG_NAME_LEN.

The maximum length of a catalog qualifier name; first part of a 3 part table name (in bytes).

SQL_MAX_ROW_SIZE (32-bit unsigned integer)
Specifies the maximum length in bytes that the server supports in single row of a base table. Zero if no limit.

SQL_MAX_ROW_SIZE_INCLUDES_LONG (string)
Set to "Y" to indicate that the value returned by SQL_MAX_ROW_SIZE InfoType includes the length of product-specific long string data types. Otherwise, set to "N".

SQL_MAX_SCHEMA_NAME_LEN (16-bit integer)
The maximum length of a schema qualifier name (in bytes).

In previous versions of DB2 CLI this fInfoType was SQL_MAX_OWNER_NAME_LEN.

SQL_MAX_STATEMENT_LEN (32-bit unsigned integer)
Indicates the maximum length of an SQL statement string in bytes, including the number of white spaces in the statement.

SQL_MAX_TABLE_NAME_LEN (16-bit integer)
The maximum length of a table name (in bytes).

SQL_MAX_TABLES_IN_SELECT (16-bit integer)
Indicates the maximum number of table names allowed in a FROM clause in a <query specification>.

SQL_MAX_USER_NAME_LEN (16-bit integer)
Indicates the maximum size allowed for a <user identifier> (in bytes).

SQL_MULT_RESULT_SETS (string)
The character string "Y" indicates that the database supports multiple result sets, "N" indicates that it does not.

SQL_MULTIPLE_ACTIVE_TXN (string)
The character string "Y" indicates that active transactions on multiple connections are allowed, "N" indicates that only one connection at a time can have an active transaction.

DB2 CLI returns "N" for coordinated distributed unit of work (CONNECT TYPE 2) connections, (since the transaction or Unit Of Work spans all connections), and returns "Y" for all other connections.

SQL_NEED_LONG_DATA_LEN (string)
A character string reserved for the use of ODBC. "N" is always returned.

SQL_NON_NULLABLE_COLUMNS (16-bit integer)
Indicates whether non-nullable columns are supported:

SQL_NULL_COLLATION (16-bit integer)
Indicates where NULLs are sorted in a list:

SQL_NUMERIC_FUNCTIONS (32-bit mask)
Indicates the ODBC scalar numeric functions supported These functions are intended to be used with the ODBC vendor escape sequence described in Using Vendor Escape Clauses.

The following bit-masks are used to determine which numeric functions are supported:

SQL_ODBC_API_CONFORMANCE (16-bit integer)
The level of ODBC conformance.

SQL_ODBC_INTERFACE_CONFORMANCE (32-bit unsigned integer)
Indicates the level of the ODBC 3.0 interface that the DB2 CLI driver conforms to:

SQL_SCHEMA_TERM (string)
The database vendor's terminology for a schema (owner).

In previous versions of DB2 CLI this InfoType was SQL_OWNER_TERM.

SQL_SCHEMA_USAGE (32-bit mask)
Indicates the type of SQL statements that have schema (owners) associated with them when these statements are executed, Schema qualifiers (owners) are:

In previous versions of DB2 CLI this InfoType was SQL_OWNER_USAGE.

SQL_ODBC_SAG_CLI_CONFORMANCE (16-bit integer)
The compliance to the functions of the SQL Access Group (SAG) CLI specification.

A value of:

SQL_ODBC_SQL_CONFORMANCE (16-bit integer)
A value of:

For the definition of the above 3 types of ODBC SQL grammar, see the ODBC 3.0 Software Development Kit and Programmer's Reference

SQL_ODBC_SQL_OPT_IEF (string)
This InfoType has been replaced with SQL_INTEGRITY.

The "Y" character string indicates that the data source supports Integrity Enhanced Facility (IEF) in SQL89 and in X/Open XPG4 Embedded SQL, an "N" indicates it does not.

SQL_ODBC_VER (string)
The version number of ODBC that the driver manager supports.

DB2 CLI will return the string "03.01.0000".

SQL_OJ_CAPABILITIES (32-bit mask)
A 32-bit bit-mask enumerating the types of outer join supported.

The bitmasks are:

SQL_ORDER_BY_COLUMNS_IN_SELECT (string)
Set to "Y" if columns in the ORDER BY clauses must be in the select list; otherwise set to "N".

SQL_OUTER_JOINS (string)
The character string:

(See Using Vendor Escape Clauses)

SQL_OWNER_TERM (string)
This InfoType has been replaced with SQL_SCHEMA_TERM.

The database vendor's terminology for a schema (owner).

SQL_OWNER_USAGE (32-bit mask)
This InfoType has been replaced with SQL_SCHEMA_USAGE.

Indicates the type of SQL statements that have schema (owners) associated with them when these statements are executed, Schema qualifiers (owners) are:

SQL_PARAM_ARRAY_ROW_COUNTS (32-bit unsigned integer)
Indicates the availability of row counts in a parameterized execution:

SQL_PARAM_ARRAY_SELECTS (32-bit unsigned integer)
Indicates the availability of result sets in a parameterized execution:

SQL_POS_OPERATIONS (32-bit mask)
Reserved option, zero is returned for the bit-mask.

SQL_POSITIONED_STATEMENTS (32-bit mask)
Indicates the degree of support for Positioned UPDATE and Positioned DELETE statements:

SQL_PROCEDURE_TERM (string)
The name a database vendor uses for a procedure

SQL_PROCEDURES (string)
A character string of "Y" indicates that the data source supports procedures and DB2 CLI supports the ODBC procedure invocation syntax specified in Using Stored Procedures. "N" indicates that it does not.

SQL_QUALIFIER_LOCATION (16-bit integer)
This InfoType has been replaced with SQL_CATALOG_LOCATION.

A 16-bit integer value indicated the position of the qualifier in a qualified table name. DB2 CLI always returns SQL_QL_START for this information type.

SQL_QUALIFIER_NAME_SEPARATOR (string)
The character(s) used as a separator between a catalog name and the qualified name element that follows it.

This InfoType has been replaced with SQL_CATALOG_NAME_SEPARATOR.

SQL_QUALIFIER_TERM (string)
The database vendor's terminology for a qualifier

The name that the vendor uses for the high order part of a three part name.

Since DB2 CLI does not support three part names, a zero-length string is returned.

This InfoType has been replaced with SQL_CATALOG_TERM.

SQL_QUALIFIER_USAGE (32-bit mask)
This fInfoType has been replaced with SQL_CATALOG_USAGE.

This is similar to SQL_OWNER_USAGE except that this is used for catalog.

SQL_QUOTED_IDENTIFIER_CASE (16-bit integer)
Returns:

This should be contrasted with the SQL_IDENTIFIER_CASE InfoType which is used to determine how (unquoted) identifiers are stored in the system catalog.

SQL_ROW_UPDATES (string)
A character string of "Y" indicates changes are detected in rows between multiple fetches of the same rows, "N" indicates that changes are not detected.

SQL_SCROLL_CONCURRENCY (32-bit mask)
Indicates the concurrency options supported for the cursor.

The following bit-masks are used in conjunction with the flag to determine which options are supported:

DB2 CLI returns SQL_SCCO_LOCK. indicating that the lowest level of locking that is sufficient to ensure the row can be updated is used.

SQL_SCROLL_OPTIONS (32-bit mask)
The scroll options supported for scrollable cursors.

The following bit-masks are used in conjunction with the flag to determine which options are supported:

For more information about scrollable cursors see Scrollable Cursors.

SQL_SEARCH_PATTERN_ESCAPE (string)
Used to specify what the driver supports as an escape character for catalog functions such as (SQLTables(), SQLColumns())

SQL_SERVER_NAME (string)
The Name of the DB2 Instance. In contrast to SQL_DATA_SOURCE_NAME, this is the actual name of the database server. (Some DBMSs provide a different name on CONNECT than the real server-name of the database.)

SQL_SPECIAL_CHARACTERS (string)
Contains all the characters in addition to a...z, A...Z, 0...9, and _ that the server allows in non-delimited identifiers.

SQL_SQL_CONFORMANCE (32-bit unsigned integer)
Indicates the level of SQL-92 supported:

SQL_SQL92_DATETIME_FUNCTIONS (32-bit mask)
Indicates the datetime scalar functions that are supported by DB2 CLI and the data source:

SQL_SQL92_FOREIGN_KEY_DELETE_RULE (32-bit mask)
Indicates the rules supported for a foreign key in a DELETE statement, as defined by SQL-92:

SQL_SQL92_FOREIGN_KEY_UPDATE_RULE (32-bit mask)
Indicates the rules supported for a foreign key in an UPDATE statement, as defined by SQL-92:

SQL_SQL92_GRANT (32-bit mask)
Indicates the clauses supported in a GRANT statement, as defined by SQL-92:

SQL_SQL92_NUMERIC_VALUE_FUNCTIONS (32-bit mask)
Indicates the numeric value scalar functions that are supported by DB2 CLI and the data source, as defined in SQL-92:

SQL_SQL92_PREDICATES (32-bit mask)
Indicates the predicates supported in a SELECT statement, as defined by SQL-92.

SQL_SQL92_RELATIONAL_JOIN_OPERATORS (32-bit mask)
Indicates the relational join operators supported in a SELECT statement, as defined by SQL-92.

SQL_SQL92_REVOKE (32-bit mask)
Indicates which clauses the data source supports in the REVOKE statement, as defined by SQL-92:

SQL_SQL92_ROW_VALUE_CONSTRUCTOR (32-bit mask)
Indicates the row value constructor expressions supported in a SELECT statement, as defined by SQL-92.

SQL_SQL92_STRING_FUNCTIONS (32-bit mask)
Indicates the string scalar functions that are supported by DB2 CLI and the data source, as defined by SQL-92:

SQL_SQL92_VALUE_EXPRESSIONS (32-bit mask)
Indicates the value expressions supported, as defined by SQL-92.

SQL_SQL92_STANDARD_CLI_CONFORMANCE (32-bit mask)
Indicates the CLI standard or standards to which DB2 CLI conforms:

SQL_STATIC_CURSOR_ATTRIBUTES1 (32-bit mask)
Indicates the attributes of a static cursor that are supported by DB2 CLI (subset 1 of 2):

SQL_STATIC_CURSOR_ATTRIBUTES2 (32-bit mask)
Indicates the attributes of a static cursor that are supported by DB2 CLI (subset 2 of 2):

SQL_STATIC_SENSITIVITY (32-bit mask)
Indicates whether changes made by an application with a positioned update or delete statement can be detected by that application:

SQL_STRING_FUNCTIONS (32-bit mask)
Indicates which string functions are supported.

The following bit-masks are used to determine which string functions are supported:

If an application can call the LOCATE scalar function with the string_exp1, string_exp2, and start arguments, the SQL_FN_STR_LOCATE bitmask is returned. If an application can only call the LOCATE scalar function with the string_exp1 and string_exp2, the SQL_FN_STR_LOCATE_2 bitmask is returned. If the LOCATE scalar function is fully supported, both bitmasks are returned.

SQL_SUBQUERIES (32-bit mask)
Indicates which predicates support subqueries:

SQL_SYSTEM_FUNCTIONS (32-bit mask)
Indicates which scalar system functions are supported.

The following bit-masks are used to determine which scalar system functions are supported:

Note:These functions are intended to be used with the escape sequence in ODBC.

SQL_TABLE_TERM (string)
The database vendor's terminology for a table

SQL_TIMEDATE_ADD_INTERVALS (32-bit mask)
Indicates whether or not the special ODBC system function TIMESTAMPADD is supported, and, if it is, which intervals are supported.

The following bitmasks are used to determine which intervals are supported:

SQL_TIMEDATE_DIFF_INTERVALS (32-bit mask)
Indicates whether or not the special ODBC system function TIMESTAMPDIFF is supported, and, if it is, which intervals are supported.

The following bitmasks are used to determine which intervals are supported:

SQL_TIMEDATE_FUNCTIONS (32-bit mask)
Indicates which time and date functions are supported.

The following bit-masks are used to determine which date functions are supported:

Note:These functions are intended to be used with the escape sequence in ODBC.

SQL_TXN_CAPABLE (16-bit integer)
Indicates whether transactions can contain DDL or DML or both.

SQL_TXN_ISOLATION_OPTION (32-bit mask)
The transaction isolation levels available at the currently connected database server.

The following masks are used in conjunction with the flag to determine which options are supported:

For descriptions of each level refer to SQL_DEFAULT_TXN_ISOLATION.

SQL_UNION (32-bit mask)
Indicates if the server supports the UNION operator:

If SQL_U_UNION_ALL is set, so is SQL_U_UNION.

SQL_USER_NAME (string)
The user name used in a particular database. This is the identifier specified on the SQLConnect() call.

SQL_XOPEN_CLI_YEAR (string)
Indicates the year of publication of the X/Open specification with which the version of the driver fully complies.

Return Codes

Diagnostics

Table 112. SQLGetInfo SQLSTATEs
SQLSTATE Description Explanation
01004 Data truncated. The requested information was returned as a string and its length exceeded the length of the application buffer as specified in BufferLength. The argument StringLengthPtr contains the actual (not truncated) length of the requested information. (Function returns SQL_SUCCESS_WITH_INFO.)
08003 Connection is closed. The type of information requested in InfoType requires an open connection. Only SQL_ODBC_VER does not require an open connection.
40003 08S01 Communication link failure. The communication link between the application and data source failed before the function completed.
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. DB2 CLI is unable to allocate memory required to support execution or completion of the function.
HY090 Invalid string or buffer length. The value specified for argument BufferLength was less than 0.
HY096 Information type out of range. An invalid InfoType was specified.
HYC00 Driver not capable. The value specified in the argument InfoType is not supported by either DB2 CLI or the data source.

Restrictions

None.

CLI Sample ilinfo.c

(The complete sample ilinfo.c is also available here .)

 
/* From the CLI sample ILINFO.C */
/* ... */
 
        sqlrc = SQLGetInfo(hdbc, SQL_DBMS_VER, imageInfoBuf, 255, &outlen);
        HANDLE_CHECK( SQL_HANDLE_DBC, hdbc, sqlrc, &henv, &hdbc ) ; 	 
        printf("            Remote DBMS Version: %s\n", imageInfoBuf);
        
 

References


[ Top of Page | Previous Page | Next Page ]