There are two ways to place a job into SQL server mode:
- The
most likely case is using the CLI function, SQLSetEnvAttr. The SQL
server mode is best suited to CLI applications because they already use the
concept of multiple connections handles. Set this mode immediately after allocating
the CLI environment. Furthermore, the job must not have run any SQL, or started
commitment control, before setting this mode. If either one of those cases
is true, the mode does not become changed to server mode, and SQL continues
to run "inline".
EXAMPLE.
.
SQLAllocEnv(&henv);
long attr;
attr = SQL_TRUE
SQLSetEnvAttr(henv,SQL_ATTR_SERVER_MODE,&attr,0);
SQLAllocConnect(henv,&hdbc);
.
.
- The second way to set server mode is using the Change Job (QWTCHGJB) API.
Refer to the APIs topic
in the information center for a complete description of the QWTCHGJB API.
As soon as SQL server mode has been set, all SQL connections and SQL statements
run in server mode. There is no switching back and forth. The job, once in
server mode, cannot start commitment control, and cannot use Interactive SQL.