The SourcePro DB Examples

The SourcePro DB examples require special attention due to the complexity of establishing a connection to a database.

SourcePro DB provides a set of examples that illustrate how to transfer data from a relational database into a client program and back again. The examples are:

SourcePro DB video rental store tutorials

Bulk operation example

Data callback example

Cache manager example

You can also use these short, simple examples to cut-and-paste into your own database-enabled applications. See the DB Interface Module for more information about the examples.

The SourcePro Evaluation Edition includes several access modules, as shown in the table below. Since SourcePro DB provides a consistent API across all supported databases, all access modules use the same examples, located in the <buildspace>\examples\dbcore directory.

Table 4. DB Access Modules and corresponding mnemonic

Module

Mnemonic (module)

DB Access Module for ODBC

odbc

DB Access Module for Microsoft SQL Server

mssql

DB Access Module for MySQL Server

mysql

DB Access Module for Oracle OCI

oraoci

DB Access Module for PostgreSQL Server

pgs

DB Access Module for DB2 CLI

db2cli

DB Access Module for Sybase

sybasect

Makefiles for the examples are located in the directories named as follows:

<buildspace>\examples\<module>\12d

where <module> corresponds to your database (odbc, mssql, mysql, oraoci, sybasect, db2cli, or pgs).

To build and run the SourcePro DB examples:

1.  Ensure that your database client software has been installed and that you can connect to your database, as specified in Software Requirements.

2.  Modify the tutorial configuration file tutdefs.h to reference your database server.

3.  Build the tutorials and the bulkcopy, datacb, and memcache examples.

4.  To run the SourcePro DB video store tutorials:

Run tutinit.exe to create all dependent database objects.

Run the individual tutorial programs.

Run tutclean.exe to clean up all the tables the tutorials create and use.

5.  To run the bulkcopy, datacb, and memcache examples, run bulkcopy.exe, datacb.exe, and memcache.exe respectively.

The following sections describe these steps in more detail.

In this section: