Databases and Connections
The DB XA Module implementation of
RWDBDatabase manages connections with database servers, just like its counterpart in the DB Interface Module. In the XA environment it is not necessary to login, so the database class represents only
accessLib and
xaParameter to fetch the respective database connection. It does not represent any user information. The database class still provides the interface for tables, queries, and direct SQL transactions. You simply obtain XA-specific instances of
RWDBDatabase from the
database() function in
RWDBManager, by passing an XA key (
xaParameter) through the
propertyString parameter.
Class
RWDBConnection encapsulates a database connection. In a non-XA SourcePro DB application, connections to a database are opened as needed. In an XA environment, connections are opened and managed by the transaction processing monitor, based on criteria defined during the set up phase of the resource manager. An
RWDBConnection does not open and close connections with the database. Instead, it attempts to get a valid handle to a database connection previously opened by the TPM, using the
xaParameter supplied. Once acquired, it holds this handle, and uses it whenever it is needed.
Obtaining an instance of a connection in the DB XA Module is identical to obtaining a connection in the non-XA version of the DB Interface Module. For example, the following call to
RWDBManager returns an
RWDBDatabase object, which, in turn, creates an instance of
RWDBConnection:
RWDBDatabase dbase=RWDBManager::database("accessLib", "", "", "",
"", "XA=xaParameter");
RWDBConnection conn=dbase.connection();
The same rules that apply to default connections in a non-XA environment apply in the XA environment. (See “Databases and Connections” in the DB Interface Module DB User’s Guide.)