I need to call FORCE APPLICATION from my C/C++ code.
The conventional way is to call sqlefrce() function which is declared in sqlenv.h file.
The problem is that the function's object code sits is db2api.lib which is missing from all the client installations. I tried IBM Data Server Driver for ODBC and CLI, IBM Data Server Driver Package, IBM Data Server Runtime Client on Windows. None of the contains this lib. It is rpesent only in the server installation.
If I try to call FORCE APPLICATION using conventinal CLI interface (calling SQLExecDirect()), I got an error like
[IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "APPLICATION" was found following "FORCE ". Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601
please tell me if I can call force application using client software only, without copying db2api.lib from server distribution
can I run SYSPROC.ADMIN_CMD() without prior connection to a database? the problem that SQLExecDirect() I use for this call, requires prior call of SQLConnect() to get the connection handle for the SQL call. On the other hand, when I call FORCE APPLICATION from db2 command line, I do not need to connect to a database
Clearly you must be connected to a database in order to execute any SQL statement, including a call to a stored procedure. FORCE APPLICATION is not an SQL statement, it is a CLP command, and as such it does not need a database connection (it requires an instance attachment though, which is done implicitly by CLP).