Data Access Samples Directory Structure
All files used for the Data Access Builder samples are located in the
followingdirectories, where x: is the
directory in which VisualAge for C++ is installed:
x:\samples\DATABASE\minisamp\db2cli |
.exe, .icc, .dax files for DB2 CLI mini-samples |
..\db2esql |
.exe, .icc, .dax files for DB2 ESQL mini-samples |
..\odbc |
.exe, .icc, .dax files for dBase ODBC mini-samples |
..\source |
common .cpp file for mini-samples |
x:\samples\DATABASE\visual\db2cli |
.exe, .icc, .dax files for DB2 CLI visual sample |
..\db2esql |
.exe, .icc, .dax files for DB2 ESQL visual sample |
..\odbc |
.exe, .icc, .dax files for dBase ODBC visual sample |
..\source |
common .vbf file for visual samples |
x:\samples\DATABASE\storproc |
files for DB2 stored procedure for DB2 mini-sample |
x:\samples\DATABASE\odbc-db |
dBase files for sample database CPPASAMP40 (working copy) |
x:\samples\DATABASE\odbc-db\backup |
backup dBase files for sample database CPPASAMP40 |
Sample Databases
To work with the Data Access Builder samples, you need to have access to one of
the following sample databases:
If you have used the samples, and if the CPPASAMP40 database has been modified as a result, you can restore a copy of the original by copying the files in the x:\samples\database\odbc-db\backup directory to the x:\samples\database\odbc-db directory (where x:\ is the directory where VisualAge C++ is installed).
Using ODBC
The sample database, CPPASAMP40, uses the dBase 5 ODBC driver that is shipped and
installed with Data Access Builder. You are not required to perform any steps to use this
dBase database with the samples.
Using DB2
If you use DB2 with VisualAge C++, then you have to first ensure that the SAMPLE database
has been created on the server that you access. If it has not, then you must create the
SAMPLE database yourself, by following these steps. If it has been created, skip to step
4.
LOGON USERID /P:PASSWORD /L
db2sampl x:
db2start
Sample Database Contents
The sample databases (DB2 SAMPLE and dBase CPPASAMP40) contain several tables used by the
Data Access Samples.
DB2 SAMPLE has a table called DEPARTMENT and dBase CPPASAMPA40 has a corresponding table called DEPT, which are used by the following samples:
The DEPARTMENT/DEPT tables have the following columns:
| Column | SQL Type |
|---|---|
| deptno | CHAR |
| deptname | VARCHAR |
| mgrno | CHAR |
| admrdept | CHAR |
| location | CHAR |
The tables also contain a table called EMPLOYEE (DB2) or EMPL (dBase), which is used by the following samples:
The EMPLOYEE/EMPL table has the following columns:
| Column | SQL Type |
|---|---|
| empno | CHAR |
| firstname | VARCHAR |
| midinit | CHAR |
| lastname | VARCHAR |
| workdept | CHAR |
| phoneno | CHAR |
| hiredate | DATE |
| job | CHAR |
| birthdate | DATE |
| sex | CHAR |
| edlevel | SMALLINT |
| salary | DECIMAL |
| bonus | DECIMAL |
| comm | DECIMAL |
The tabljoin sample uses a table join created with columns from DEPARTMENT/DEPT and EMPLOYEE/EMPL. The resulting join, called Query, has the following columns:
| Column | SQL Type | From Table |
|---|---|---|
| deptname | varchar | DEPARTMENT/DEPT |
| firstname | varchar | EMPLOYEE/EMPL |
| lastname | varchar | EMPLOYEE/EMPL |
| midinit | varchar | EMPLOYEE/EMPL |
The DB2 sample database contains another table, called EMP_PHOTO, which is used in the following samples:
EMP_PHOTO has the following columns:
| Column | SQL Type |
|---|---|
| empno | CHAR |
| photo_format | VARCHAR |
| picture | LONG VARBINARY (BLOB) |
The DB2 sample database also has a stored procedure defined on it. It is called COLSTATS.
![]()
Data Access Class Library and Generated Class
Reference
Data Access Builder Samples
