SET host_variable

Provides information about OpenESQL connections and databases.


>>--EXEC SQL-->
 >SET :host_variable = >
 >----.-CURRENT CONNECTION-.------------.----------.-->
      +-CURRENT DATABASE---.------------.----------+
 >---END EXEC---><


host_variable A PIC X(n) host variable
char Any single printable character or space
Note: For a full description of each option and its corresponding parameters, see the equivalent SQL Compiler Directive Options topic as listed in the Related reference section below.


This statement returns the name of the current connection or the type of database for the current connection as specified in the EXEC SQL CONNECT statement in the specified host variable.

If there is no current open connection, host_variable is set to NONE for both CURRENT CONNECTION and CURRENT DATABASE.

With CURRENT CONNECTION, you can use host_variable in a subsequent EXEC SQL SET CONNECTION statement.

With CURRENT DATABASE, if there is a current open connection, host_variable is set to one of the following values, depending on the connection:

  • DB2
In addition to the OPTION syntax specified above, you can optionally place an equals (=) sign between the option and its parameter. For example, the following are equivalent:
exec sql set :myhostvar option date EUR end-exec
exec sql set :myhostvar option date=EUR end-exec