Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB XA Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWDBConnection

Module:  DB Interface Module   Group:  Database Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/db/connect.h>

RWDBConnection connection = myDbase.connection();

Description

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 in this environment, does not have the responsibility of opening and closing a database connection directly with the server. Instead, it attempts to get a valid handle to a connection previously opened by the TPM. This handle is held, and used whenever it is needed.

Even though the TPM actually establishes connections, your programs will still request RWDBConnection objects from an RWDBDatabase. Connection objects specify which connection a method should use. Operations requested without supplying a connection are performed using a connection invisibly supplied by RWDBDatabase. If none are available, an error results. Thus, the use of explicit connections eliminates one likely source of errors.

In the DB Interface Module there is a restriction on the number of RWDBConnection objects that you can create. This is because the DB Interface Module makes use of connections opened by the TPM. Therefore the user should be careful when using default connections. If the number of connections requested is greater than one, the DB Interface Module will return a notSupported error (with the exception of Sybase CT).


NOTE -- We recommend that you always use explicit connections.

Because the TPM actually opens and closes connections, the following RWDBConnection member functions should not be called when using the DB Interface Module: open() and close().

Transactions in an XA environment are controlled by the TPM. Therefore, the following methods should not be called in an XA connection: beginTransaction(), commitTransaction(), rollbackTransaction(), and autocommit().

Each RWDBConnection knows which RWDBDatabase produced it, and each RWDBDatabase knows what connections it has produced.

RWDBConnection is designed around the Interface / Implementation paradigm. An RWDBConnection instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBConnection's implementation is a base class from which a family of XA-enabled, database-specific connection implementations is derived.

Public Enum

These are the values used for the isolation() methods:

enum IsolationType {
Unknown,                   // the default
ANSILevel1,
ANSILevel2,
ANSILevel3
}

These are the values used for the connectionType() methods:

enum ConnectionType {
Synchronous = 1
Asynchronous
}

These values do not have a special impact on an XA connection.

Public Constructors

RWDBConnection();
RWDBConnection(const RWDBConnection& connection);

Public Member Operators

RWDBConnection&
operator=(const RWDBConnection& connection);
bool 
operator==(const RWDBConnection& conn) const;
bool 
operator!=(const RWDBConnection& conn) const;

Public Member Functions

void
acquire() const;
RWDBStatus
beginTransaction(); 
RWDBStatus
close(); 
RWDBStatus
commitTransaction();
RWDBConnection::ConnectionType
connectionType() const;
RWDBDatabase
database() const;
RWDBStatus::ErrorHandler
errorHandler() const;
RWDBResult
executeSql(const RWCString& sqlProgram) const;
RWDBConnection::IsolationType
isolation() const;
RWDBStatus
isolation(RWDBConnection::IsolationType level);
bool
isReady() const;
bool
isValid() const;
RWDBStatus
open(); 
void
release() const;
RWDBStatus
rollbackTransaction();
void
setErrorHandler(RWDBStatus::ErrorHandler handler);
RWDBStatus
status() const;
RWDBSystemHandle*
systemHandle();


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.