home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / database / stockcpp / readme.txt < prev    next >
Encoding:
Text File  |  1996-02-22  |  9.6 KB  |  220 lines

  1.  **********************************************************************
  2.  * DISCLAIMER OF WARRANTIES:                                          *
  3.  *                                                                    *
  4.  * The following enclosed code is sample code created by IBM          *
  5.  * Corporation.  This sample code is not part of any standard IBM     *
  6.  * product and is provided to you solely for the purpose of assisting *
  7.  * you in the development of your applications.  The code is provided *
  8.  * "AS IS", without warranty of any kind.  IBM shall not be liable    *
  9.  * for any damages arising out of your use of the sample code, even   *
  10.  * if they have been advised of the possibility of such damages       *
  11.  *                                                                    *
  12.  **********************************************************************
  13.  
  14.  
  15. NAME:
  16.        Data Access C++ Stock Sample
  17.  
  18. FEATURES/CONCEPTS:
  19.        This sample illustrates how to use the Data Access Builder Class Library
  20.        and the code generated by the Data Access Builder Tool to access an ODBC
  21.        database table in a C++ program. It shows how to connect to a database,
  22.        manipulate data, make transactions, and disconnect from a database. It
  23.        also shows how users can build their own customized classes derived from
  24.        the Data Access Builder Classes.  This sample also illustrates the use
  25.        of multiple connections to a datastore.
  26.  
  27. TASK:
  28.        A simple C++ program that updates stock inventory and received-order
  29.        information that are kept in two ODBC database tables and generates a
  30.        price list from the data.
  31.  
  32. DESCRIPTION:
  33.        This sample program generates a price list from the initial data. It
  34.        then adds more rows to the inventory and receivedorder tables,
  35.        calculates the new values and updates the tables. It then generates an
  36.        updated price list.
  37.  
  38. SOURCE FILE LOCATION:
  39.  
  40.        X:\ibmcppw\samples\database\stockcpp
  41.  
  42.        where 'X:' is the drive you installed the samples and document component
  43.        of VisualAge for C++.
  44.  
  45.  
  46. NOTE:  By default, this examples works with a supplied DBASE ODBC database.
  47.        The following description applies on how to rebuild the sample using
  48.        the supplied DBASE database.
  49.  
  50.        You may also use this sample against local or remote database such as
  51.        DB2 using embedded SQL, CLI or ODBC. You may also use this sample with
  52.        other ODBC Databases such as SYBASE or ORACLE.
  53.  
  54. HOW TO BUILD THE SAMPLE:
  55.  
  56.   1) Change to the X:\ibmcppw\samples\database\stockcpp directory--where
  57.      'X:' is the drive you installed the samples component of
  58.      VisualAge for C++.
  59.  
  60.      - If you are using Workframe  Invoke the workframe project by typing
  61.  
  62.          iwf stockcpp
  63.  
  64.      NOTE: If you are using embedded SQL, you must either first run RESETTBE
  65.            from the command line before invoking workframe, or you must set the
  66.            environment variable ISESQL=TRUE as follows
  67.  
  68.            - first choose the view menu item, then choose setting-environment
  69.              variables.
  70.            - set the ISESQL environment variable.
  71.  
  72.   2) If you wish to regenerate the Data Access Builders code you may do so
  73.      using the supplied .DAX file. If you use the supplied .DAX file then from
  74.      the command line type
  75.  
  76.        IDATA Stockcpp.DAX
  77.  
  78.      then proceed to step 3.
  79.  
  80.      If you are not using the supplied .DAX file from the command line type
  81.  
  82.        IDATA
  83.  
  84.      If you are using workframe :
  85.  
  86.        If you wish to use the existing .DAX file, click the right mouse button
  87.        and select Database.
  88.  
  89.        If you wish not to use the supplied .DAX file, select the Project menu
  90.        item and select Database.
  91.        You may then proceed to step 3.
  92.  
  93.      Create the table mappings by doing the following:
  94.  
  95.        a. Click on Create Classes from the Data Access Builder's startup window
  96.           or select Create Classes from the File menu.
  97.        b. Select ODBC DataSources for the Database Type field.
  98.           - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
  99.                   choose the DB2 Version.
  100.        b. Select DAXSAMP database and click on Connect. Two tables INVENTO and
  101.           RECEIVE are now shown in the table list box.
  102.        c. Click on INVENTO and RECEIVE and then Create classes.
  103.        d. From the Generate Options window select C++, then select ODBC as the
  104.           access method and click on OK.  The table class mappings are now
  105.           shown.
  106.           - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
  107.                   choose the appropriate access method with C++.
  108.        e. Click Mouse Button two on the Invento table icon and select Create
  109.           class.  From the Generate Options panel make the same selections as
  110.           in the previous step and click on OK.
  111.        f. Double click on the Invento1 class icon (blue sphere). The class
  112.           notebook is shown.  On the Names page:
  113.             - change the class name "Invento1" to "Prclist" and hit enter
  114.             - change the file stem to "Prclist" and hit enter
  115.             - deselect the Generate Makefile and the automatic link to
  116.               application checkboxed then double click on the close box.
  117.        g. Double click on the Invento class icon. The class notebook is
  118.           shown.  On the Names page:
  119.             - deselect the Generate Makefile and the automatic link to
  120.               application checkboxes then double click on the close box.
  121.        h. Double click on the Receive class icon. The class notebook is
  122.           shown.  On the Names page:
  123.             - deselect the Generate Makefile and the automatic link to
  124.               application checkboxes then double click on the close box.
  125.        i. The mapping is done. You can save this mapping by selecting Save from
  126.           the File menu.
  127.  
  128.   3) Click Mouse Button 2 on each of the class icons (blue spheres) in turn,
  129.      select GENERATE for each from the pop-up menu.  Close the Data Access
  130.      Builder session by selecting Exit from the File menu.
  131.  
  132.  
  133.   4) To build the executable for ODBC or CLI from the command line type:
  134.  
  135.        NMAKE
  136.  
  137.      NOTE : If you are rebuilding for Embedded SQL, type
  138.  
  139.        nmake -f esql.mak.
  140.  
  141.      FROM WORKFRAME :
  142.  
  143.       Select Build Normal from the Project menu item.
  144.  
  145.       NOTE: If you are rebuilding the sample to use Embedded SQL, you must
  146.             first select the build normal option via the option pull-down and
  147.             you must choose the DB2 Precompile option.
  148.  
  149. HOW TO RUN THE SAMPLE:
  150.  
  151.   After following the steps above to build the sample:
  152.  
  153.   From the command line :
  154.  
  155.   - from the X:\ibmcppw\samples\database\stockcpp directory (where 'X:' is
  156.     the drive you installed the samples component of VisualAge for C++ BETA)
  157.     enter:
  158.  
  159.        RESETTBO - to reset the database tables to their intial state.
  160.  
  161.        CLIENT   - execute the generated program.
  162.  
  163.   From Workframe :
  164.  
  165.     Double click on the RESETTBO.BAT file.
  166.  
  167.     Right mouse click on the Client.exe file. Then Choose the RUN
  168.     monitored option.
  169.  
  170.   The application will print the original price list followed by an updated
  171.   price list reflecting the logged transactions.
  172.  
  173.   NOTE: If you are accessing a remote server, you may be required to supply
  174.         a userid and password. They may be passed to RESETTBO and CLIENT.
  175.         If you are using CLI use RESETTBC and if you are using Embedded SQL
  176.         use RESETTBE.
  177.  
  178.  
  179. FILE NAME(S)     DESCRIPTION
  180. ============     ===========
  181.  
  182. RESETTBO.BAT     This file resets the Car table to its intial state.
  183.                  Use this file when using ODBC.
  184. RESETTBC.BAT     This file resets the Car table to its inital state.
  185.                  Use this file when using CLI.
  186. RESETTBE.BAT     This file resets the Car table to its intial state.
  187.                  Use this file when using Embedded SQL.
  188. MAKEFILE         This is the makefile used to build the sample application
  189.                  from the command line.
  190. STORE.HPP        This header declares a class called Store that uses
  191.                  the Data Access Builder Class Library and the code
  192.                  that is generated by the Data Access Builder Tool.
  193.                  This Store class takes care of connect, disconnect,
  194.                  transact, and all the data manipulation of database
  195.                  tables for this sample.
  196. STORE.CPP        This source file is the implementation of the Store Class.
  197. CLIENT.CPP       This is the client application that gives an example of how
  198.                  the store class can be used.
  199. CLIENT.EXE       This is the executable.
  200. CLIENT.PDB       This file may be used if you are using the BROWSER.
  201. CRTDB.BAT        This file creates a local DB2 database called DAXSAMP.
  202.                  You must run RESETTBE or RESETTBC after creating the local DB2
  203.                  database to create and populate the database tables.
  204.                  NOTE: If you are accessing a remote DB2 server, the database
  205.                        must be created on the remote server and cataloged on
  206.                        the local client.
  207. ESQL.MAK         Use this Make file is you are recreating the application from
  208.                  the command line and are using Embedded SQL.
  209. STOCKCPP.DAX     This file is used to regenerate the Data Access Builder files
  210.                  if you want to rebuild the sample.
  211. STOCKCPP.IWO     This file is used to store the options associated with the
  212.                  workframe project.
  213. STOCKCPP.IWP     This file is used to invoke the workframe project associated
  214.                  with this sample.
  215. README.TXT       This file.
  216.  
  217.  
  218.  
  219.  
  220.