home *** CD-ROM | disk | FTP | other *** search
- **********************************************************************
- * DISCLAIMER OF WARRANTIES: *
- * *
- * The following enclosed code is sample code created by IBM *
- * Corporation. This sample code is not part of any standard IBM *
- * product and is provided to you solely for the purpose of assisting *
- * you in the development of your applications. The code is provided *
- * "AS IS", without warranty of any kind. IBM shall not be liable *
- * for any damages arising out of your use of the sample code, even *
- * if they have been advised of the possibility of such damages *
- * *
- **********************************************************************
-
-
- NAME:
- Data Access SOM Stock Sample
-
- FEATURES/CONCEPTS:
- This sample illustrates how to use the Data Access Builder Class Library
- and the code generated by the Data Access Builder Tool to access an ODBC
- database table in a SOM C++ program. It shows how to connect to a
- database, manipulate data, make transactions, and disconnect from a
- database. It also shows how users can build their own customized classes
- derived from the Data Access Builder Classes. This sample also
- illustrates the use of multiple connections to a datastore.
-
- TASK:
- A simple SOM C++ program that updates stock inventory and received-order
- information that are kept in two ODBC database tables and generates a
- price list from the data.
-
- DESCRIPTION:
- This sample program generates a price list from the initial data. It
- then adds more rows to the inventory and receivedorder tables,
- calculates the new values and updates the tables. It then generates an
- updated price list.
-
- SOURCE FILE LOCATION:
-
- X:\ibmcppw\samples\database\stocksom
-
- where 'X:' is the drive you installed the samples and document component
- of VisualAge for C++.
-
-
- NOTE: By default, this examples works with a supplied DBASE ODBC database.
- The following description applies on how to rebuild the sample using the
- supplied DBASE database.
-
- You may also use this sample against local or remote database such as
- DB2 using embedded SQL, CLI or ODBC or you may also use this sample with
- other ODBC Databases such as SYBASE or ORACLE.
-
- HOW TO BUILD THE SAMPLE:
-
-
- 1) Change to the X:\ibmcppw\samples\database\stocksom directory--where
- 'X:' is the drive you installed the samples component of
- VisualAge for C++.
-
- - If you are using Workframe Invoke the workframe project by typing
-
- iwf stocksom
-
- NOTE: If you are using embedded SQL, you must either first run RESETTBE
- from the command line before invoking workframe, or you must set the
- environment variable ISESQL=TRUE as follows
-
- - first choose the view menu item, then choose setting-environment
- variables.
- - set the ISESQL environment variable.
-
-
- 2) If you wish to regenerate the Data Access Builders code you may do so
- using the supplied .DAX file. If you use the supplied .DAX file then from
- the command line type
-
- IDATA Stocksom.DAX
-
- then proceed to step 3.
-
- If you are not using the supplied .DAX file from the command line type
-
- IDATA
-
- If you are using workframe :
-
- If you wish to use the existing .DAX file, click the right mouse button
- and select Database.
-
- If you wish not to use the supplied .DAX file, select the Project menu
- item and select Database.
- You may then proceed to step 3.
-
- Create the table mappings by doing the following:
-
- a. Click on Create Classes from the Data Access Builder's startup window
- or select Create Classes from the File menu.
- b. Select ODBC DataSources for the Database Type field.
- - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
- choose the DB2 Version.
- b. Select DAXSAMP database and click on Connect. Two tables INVENTO and
- RECEIVE are now shown in the table list box.
- c. Click on INVENTO and RECEIVE and then Create classes.
- d. From the Generate Options window select IDL, then select ODBC as the
- access method and click on OK. The table class mappings are now
- shown.
- - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
- choose the appropriate access method with IDL.
- e. Click Mouse Button two on the Invento table icon and select Create
- class. From the Generate Options panel make the same selections as
- in the previous step and click on OK.
- f. Double click on the Invento1 class icon (blue sphere). The class
- notebook is shown. On the Names page:
- - change the class name "Invento1" to "Prclist" and hit enter
- - change the file stem to "Prclist" and hit enter
- - deselect the Generate Makefile and the automatic link to
- application checkboxed then double click on the close box.
- g. Double click on the Invento class icon. The class notebook is
- shown. On the Names page:
- - deselect the Generate Makefile and the automatic link to
- application checkboxes then double click on the close box.
- h. Double click on the Receive class icon. The class notebook is
- shown. On the Names page:
- - deselect the Generate Makefile and the automatic link to
- application checkboxes then double click on the close box.
- i. The mapping is done. You can save this mapping by selecting Save from
- the File menu.
-
- 3) Click Mouse Button 2 on each of the class icons (blue spheres) in turn,
- select GENERATE for each from the pop-up menu. Close the Data Access
- Builder session by selecting Exit from the File menu.
-
-
- 4) To build the executable for ODBC or CLI from the command line type:
-
- nmake -f bindings.mak
- nmake
-
- NOTE : If you are rebuilding for Embedded SQL, type
-
- nmake -f bindings.mak
- nmake -f esql.mak
-
- from Workframe:
-
- Select the bindings.mak file, right mouse click and select make.
-
- Select Build Normal from the Project menu item.
-
- NOTE: If you are rebuilding the sample to use Embedded SQL, you must first
- select the build normal option via the option pull-down and you must
- choose the DB2 Precompile option.
-
-
- HOW TO RUN THE SAMPLE:
-
- After following the steps above to build the sample:
-
- From the command line.
-
- - from the X:\ibmcppw\samples\database\stocksom directory (where 'X:' is
- the drive you installed the samples component of VisualAge for C++ BETA)
- enter:
-
- RESETTBO - to reset the database tables to their intial state.
-
- CLIENT - execute the generated program.
-
- From Workframe:
-
- Double click on the RESETTBO.BAT file.
-
- Right Mouse click on the Client.exe file and Choose the
- run monitoried option.
-
- The application will print the original price list followed by an updated
- price list reflecting the logged transactions.
-
- NOTE: If you are accessing a remote server, you may be required to supply
- a userid and password. They may be passed to RESETTBO and CLIENT.
- If you are using CLI use RESETTBC and if you are using Embedded SQL
- use RESETTBE.
-
-
-
- FILE NAME(S) DESCRIPTION
- ============ ===========
- RESETTBO.BAT This file resets the Car table to its intial state.
- Use this file when using ODBC.
- RESETTBC.BAT This file resets the Car table to its inital state.
- Use this file when using CLI.
- RESETTBE.BAT This file resets the Car table to its intial state.
- Use this file when using Embedded SQL.
- MAKEFILE This is the makefile used to build the sample application from
- the command line.
- CLIENT.CPP This is the client application that gives an example of how
- the store class can be used.
- CLIENT.EXE This is the executable.
- CRTDB.BAT This file creates a local DB2 database called DAXSAMP.
- You must run RESETTBE or RESETTBC after creating the local DB2
- database to create and populate the database tables.
- NOTE: If you are accessing a remote DB2 server, the database
- must be created on the remote server and cataloged on the
- local client.
- ESQL.MAK Use this Make file is you are recreating the application from
- the command line and are using Embedded SQL.
- STOCKSOM.DAX This file is used to regenerate the Data Access Builder files
- if you want to rebuild the sample.
- STOCKSOM.IWO This file is used to store the options associated with the
- workframe project.
- STOCKSOM.IWP This file is used to invoke the workframe project associated
- with this sample.
- BINDINGS.MAK This file must be run before nmake on MAKEFILE or nmake on
- ESQL.MAK or before a workframe Build.
- README.TXT This file.
-
-