The access library for DB2 CLI returns an environment handle that has the type RWDBDB2CLILibEnvironmentHandle. This handle provides methods that an application can use to set or retrieve certain connect time and configuration parameters. The available applications are described in Section 2.15.1 to Section 2.15.5.
Please note that connect time parameters are set only when a connection is established with the server. When a method returns a valid RWDBStatus, it doesn't necessarily mean that the connection parameter has been accepted by the server. Appropriate error messages will be fielded to the application only when a connection is established.
NOTE: The maximum concurrent connections, connection type and sync point parameters are set at the environment level. The first connection determines the acceptable attributes for subsequent connections. DBTools.h++ establishes a default connection to the server by default when an RWDBDatabase object is produced. This means that the application must disable the default behavior by calling the static method RWDBDatabase::connect(FALSE) before producing the RWDBDatabase object in order to have desired attributes in effect.
The maxConnections method sets the maximum concurrent connections for an application. Two methods are available:
SQLINTEGER maxConnections() const; RWDBStatus maxConnections(SQLINTEGER value);
The default value of 0 means that the application can set up as many connections as system resources permit. Any other value indicates a limit on the number of connections. Please refer to the Call Level Interface Guide and Reference for Common Servers (Version 2) from IBM for detailed information.
The connectType method specifies whether the application is to operate in a coordinated or uncoordinated distributed environment. Two methods are available:
SQLINTEGER connectType() const; RWDBStatus connectType(SQLINTEGER value);
The default value is SQL_CONCURRENT_TRANS, which means that applications operate inan uncoordinated distibuted environment. If the value is set to SQL_COORDINATED_TRANS processing is coordinated. Whenever processing is coordinated, you must consider the sync point setting described in Section 2.15.3, "Sync Point.". Please refer to the Call Level Interface Guide and Reference for Common Servers from IBM for detailed information.
The syncPoint method specifies whether transactions are one-phase coordinated or two-phase coordinated. Two methods are available:
SQLINTEGER syncPoint() const; RWDBStatus syncPoint(SQLINTEGER value);
The default value is SQL_ONEPHASE. The alternative value is SQL_TWOPHASE. Please refer to the Call Level Interface Guide and Reference for Common Servers (Version 2) from IBM for detailed information.
The loginTimeout() method is not supported in DB2 CLI. It has been removed from the library.
The accessMode method sets the read/write mode for a connection. Two methods are available:
SQLINTEGER accessMode() const; RWDBStatus accessMode(SQLINTEGER value);
The access mode may be set to either SQL_MODE_READ_ONLY or SQL_MODE_READ_WRITE, which is the default. SQL_MODE_READ_ONLY is used by the driver to indicate that the connection is not required to support the SQL statement that causes updates to occur.
The access library for DB2 CLI has not implemented the virtual functions:
foreignKeysFromView() and foreignKeysFromView(RWBoolean value).
Both functions are therefore no-ops which return false.
The following example shows how to gain access to RWDBDB2CLILibEnvironmentHandle. Note that the application must be compiled with an include path to the DB2 CLI include files.
#include <rw/db/db2clisrc/db2envh.h> RWDBEnvironmentHandle* enH = adb.environmentHandle(); RWDBDB2CLILibEnvironmentHandle* db2cliH= (RWDBDB2CLILibEnvironmentHandle*)enH; // Set access mode db2cliH->accessMode(SQL_MODE_READ_ONLY); // Get Connection RWDBConnection conn = adb.connection();
This RWDBConnection will be created with a read-only access mode. Any attempt to change the database through this connection will result in a driver error.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.