Introduction to SourcePro® C++ : Chapter 4 SourcePro DB
Chapter 4 SourcePro DB
Definition
SourcePro DB is the Rogue Wave C++ interface to relational databases. It is a complete library of classes that encapsulate SQL 92 Data Manipulation Language (DML) and Data Definition Language (DDL) constructs. Use of SourcePro DB requires the interaction of at least two modules:
The DB Interface Module
A DB Access Module
While both modules are required, DB Access Module classes are used only by the DB Interface Module to interact with the database; you interact only with the interfaces of the DB Interface Module classes. This design lets you write an application once, and reuse it with different databases simply by changing Access Modules. The architecture of SourcePro DB is shown in Figure 3.
Figure 3 – The Architecture of SourcePro DB
SourcePro DB can also be enabled with a third module:
The DB XA Module
The DB XA Module allows SourcePro DB applications to work through a transaction processing monitor (TPM). Please contact your sales representative for information regarding installation, configuration, and support for this module.
The following sections define the SourcePro DB modules in more detail. For a code example using SourcePro DB with other SourcePro C++ products, see “An Example Using the Threads Module and the DB Interface Module” and “Example Using Modules from SourcePro Core, SourcePro DB, and SourcePro Net”.
The DB Interface Module
The DB Interface Module provides a C++ programming interface that is invariable across all supported databases. It contains the classes that you use to write your application. In general, these classes encapsulate basic database constructs, such as connections and tables, and basic data manipulation operations, such as SELECT, INSERT, UPDATE, and DELETE.
To aid navigation, the DB Interface Module can be divided into the following class groups:
Datatype Classes
Database Classes
Data Manipulation Classes
Expression Classes
Bulk Classes
Callback Classes
Open SQL Classes
Utility and Diagnostics Classes
These class groups are accessible through the Modules tab of the SourcePro C++ API Reference Guide.
The DB Access Modules
The individual DB Access Modules contain classes that implement the functionality expressed by the API of the DB Interface Module for a particular vendor’s database. These classes provide the working methods for the DB Interface Module classes. Although most of these classes are not visible to the developer, a DB Access Module is a required part of every installation of SourcePro DB. You can access classes for manipulating system and environmental variables for each of the access modules. See the Modules tab of the SourcePro C++ API Reference Guide.
There are seven DB Access Modules:
The DB Access Module for DB2
The DB Access Module for Microsoft SQL Server
The DB Access Module for ODBC
The DB Access Module for Oracle OCI
The DB Access Module for Sybase
The DB Access Module for MySQL
The DB Access Module for PostgreSQL
Each module has its own user’s guide, which describes its unique features when used with SourcePro DB.
The DB XA Module
The DB XA Module consists of class implementations and functions within SourcePro DB that allow SourcePro DB applications to work through a transaction processing monitor (TPM). The module facilitates communication between a middle-tier application server and a resource manager in a distributed transaction processing environment. It works by exposing the transactional connections established by the TPM to the application.
NOTE >> Support for the DB XA Module is available only when Rogue Wave Solution Services installs and configures the DB XA Module for specific platforms and XA-compliant Transaction Processing Monitors (TPMs). Please contact your Rogue Wave account representative for more information.