The SourcePro DB Examples
Overview
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 User's Guide for more information about the examples.
SourcePro Core includes two access modules. Since SourcePro DB provides a consistent API across all supported databases, both 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 MySQL Server
mysql
DB Access Module for PostgreSQL Server
pgs
Makefiles for the examples are located in the directories named as follows:
<buildspace>\examples\<module>\12d
where <module> corresponds to your database (mysql, 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.