Run DB2 UDB CLI in server mode

This topic is about why and how you should run your DB2® UDB CLI applications in server mode.

The reason for running in SQL server mode is that many applications have the need to act as database servers. This means that a single job performs SQL requests on behalf of multiple users. Without using SQL server mode, applications might encounter one or more of the following three limitations:
  1. A single job can only have one commit transaction per activation group.
  2. A single job can only connect to an RDB once.
  3. All SQL statements run under the job's user profile, regardless of the user ID passed in on the connect.

SQL server mode circumvents these limitations by routing all SQL statements to separate jobs. Each connection runs in its own job. The system uses prestart jobs in the QSYSWRK subsystem to minimize the startup time for each connection. Because each call to SQLConnect can accept a different user profile, each job also has its own commit transaction. As soon as the SQLDisconnect has been performed, the job is reset and put back in the pool of available jobs.