OpenSQL Reference Guide > OpenSQL Reference Guide > OpenSQL Features > Status Information > The Dbmsinfo Function—Retrieve Information on Current Session
Was this helpful?
The Dbmsinfo Function—Retrieve Information on Current Session
Dbmsinfo is a function that returns a string containing information about the current session. This statement can be used in the Terminal Monitor or in an embedded OpenSQL application.
The dbmsinfo statement has the following syntax:
SELECT DBMSINFO ('request_name') [AS result_column]
For example, to determine which version of the Enterprise Access product or server you are using, enter:
select dbmsinfo('_version');
In OpenSQL, only one dbmsinfo request is allowed per SELECT statement. In addition, when issuing a SELECT DBMSINFO statement, you cannot specify other SELECT statement clauses (such as FROM or WHERE).
The following table lists valid request_names:
Request Name
Response Description
autocommit_state
Returns 1 if autocommit is on; 0 if autocommit is off.
_bintim
Returns the current time and date in an internal format, represented as the number of seconds since January 1, 1970 00:00:00 GMT.
database
Returns the name of the database to which the session is connected.
dba
Returns the DBMS username of the database owner.
_et_sec
Returns the elapsed time for session, in seconds.
query_language
Returns query language in use (“SQL”).
server_class
Returns the class of DBMS server, for example “db2”.
terminal
Returns the terminal address for local connections.
transaction_state
Returns 1 if presently in a transaction, 0 if not.
unicode_normalization
Returns blank if the database does not support Unicode or does not perform normalization. Returns NFC if the database supports the NFC normalization form. Returns NFD if the database supports the NFD normalization form.
username
Returns the DBMS user name of the current session's user (like user).
_version
Returns the DBMS version number.
Last modified date: 08/28/2024