home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / database / stocksom / readme.txt < prev    next >
Encoding:
Text File  |  1996-02-22  |  9.4 KB  |  219 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 SOM 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 SOM C++ program. It shows how to connect to a
  22.        database, manipulate data, make transactions, and disconnect from a
  23.        database.  It also shows how users can build their own customized classes
  24.        derived from the Data Access Builder Classes.  This sample also
  25.        illustrates the use of multiple connections to a datastore.
  26.  
  27. TASK:
  28.        A simple SOM 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\stocksom
  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 the
  48.        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 or 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.  
  57.   1) Change to the X:\ibmcppw\samples\database\stocksom directory--where
  58.      'X:' is the drive you installed the samples component of
  59.      VisualAge for C++.
  60.  
  61.      - If you are using Workframe  Invoke the workframe project by typing
  62.  
  63.          iwf stocksom
  64.  
  65.      NOTE: If you are using embedded SQL, you must either first run RESETTBE
  66.            from the command line before invoking workframe, or you must set the
  67.            environment variable ISESQL=TRUE as follows
  68.  
  69.            - first choose the view menu item, then choose setting-environment
  70.              variables.
  71.            - set the ISESQL environment variable.
  72.  
  73.  
  74.   2) If you wish to regenerate the Data Access Builders code you may do so
  75.      using the supplied .DAX file. If you use the supplied .DAX file then from
  76.      the command line type
  77.  
  78.        IDATA Stocksom.DAX
  79.  
  80.      then proceed to step 3.
  81.  
  82.      If you are not using the supplied .DAX file from the command line type
  83.  
  84.        IDATA
  85.  
  86.      If you are using workframe :
  87.  
  88.        If you wish to use the existing .DAX file, click the right mouse button
  89.        and select Database.
  90.  
  91.        If you wish not to use the supplied .DAX file, select the Project menu
  92.        item and select Database.
  93.        You may then proceed to step 3.
  94.  
  95.      Create the table mappings by doing the following:
  96.  
  97.        a. Click on Create Classes from the Data Access Builder's startup window
  98.           or select Create Classes from the File menu.
  99.        b. Select ODBC DataSources for the Database Type field.
  100.           - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
  101.                   choose the DB2 Version.
  102.        b. Select DAXSAMP database and click on Connect. Two tables INVENTO and
  103.           RECEIVE are now shown in the table list box.
  104.        c. Click on INVENTO and RECEIVE and then Create classes.
  105.        d. From the Generate Options window select IDL, then select ODBC as the
  106.           access method and click on OK.  The table class mappings are now
  107.           shown.
  108.           - NOTE: if you are retargeting the sample to use CLI or Embedded SQL,
  109.                   choose the appropriate access method with IDL.
  110.        e. Click Mouse Button two on the Invento table icon and select Create
  111.           class.  From the Generate Options panel make the same selections as
  112.           in the previous step and click on OK.
  113.        f. Double click on the Invento1 class icon (blue sphere). The class
  114.           notebook is shown.  On the Names page:
  115.             - change the class name "Invento1" to "Prclist" and hit enter
  116.             - change the file stem to "Prclist" and hit enter
  117.             - deselect the Generate Makefile and the automatic link to
  118.               application checkboxed then double click on the close box.
  119.        g. Double click on the Invento class icon. The class notebook is
  120.           shown.  On the Names page:
  121.             - deselect the Generate Makefile and the automatic link to
  122.               application checkboxes then double click on the close box.
  123.        h. Double click on the Receive class icon. The class notebook is
  124.           shown.  On the Names page:
  125.             - deselect the Generate Makefile and the automatic link to
  126.               application checkboxes then double click on the close box.
  127.        i. The mapping is done. You can save this mapping by selecting Save from
  128.           the File menu.
  129.  
  130.   3) Click Mouse Button 2 on each of the class icons (blue spheres) in turn,
  131.      select GENERATE for each from the pop-up menu.  Close the Data Access
  132.      Builder session by selecting Exit from the File menu.
  133.  
  134.  
  135.   4) To build the executable for ODBC or CLI from the command line type:
  136.  
  137.        nmake -f bindings.mak
  138.        nmake
  139.  
  140.      NOTE : If you are rebuilding for Embedded SQL, type
  141.  
  142.        nmake -f bindings.mak
  143.        nmake -f esql.mak
  144.  
  145.      from Workframe:
  146.  
  147.       Select the bindings.mak file, right mouse click and select make.
  148.  
  149.       Select Build Normal from the Project menu item.
  150.  
  151.       NOTE: If you are rebuilding the sample to use Embedded SQL, you must first
  152.             select the build normal option via the option pull-down and you must
  153.             choose the DB2 Precompile option.
  154.  
  155.  
  156. HOW TO RUN THE SAMPLE:
  157.  
  158.   After following the steps above to build the sample:
  159.  
  160.   From the command line.
  161.  
  162.   - from the X:\ibmcppw\samples\database\stocksom directory (where 'X:' is
  163.     the drive you installed the samples component of VisualAge for C++ BETA)
  164.     enter:
  165.  
  166.        RESETTBO - to reset the database tables to their intial state.
  167.  
  168.        CLIENT   - execute the generated program.
  169.  
  170.   From Workframe:
  171.  
  172.     Double click on the RESETTBO.BAT file.
  173.  
  174.     Right Mouse click on the Client.exe file and Choose the
  175.     run monitoried option.
  176.  
  177.   The application will print the original price list followed by an updated
  178.   price list reflecting the logged transactions.
  179.  
  180.   NOTE: If you are accessing a remote server, you may be required to supply
  181.         a userid and password. They may be passed to RESETTBO and CLIENT.
  182.         If you are using CLI use RESETTBC and if you are using Embedded SQL
  183.         use RESETTBE.
  184.  
  185.  
  186.  
  187. FILE NAME(S)     DESCRIPTION
  188. ============     ===========
  189. RESETTBO.BAT     This file resets the Car table to its intial state.
  190.                  Use this file when using ODBC.
  191. RESETTBC.BAT     This file resets the Car table to its inital state.
  192.                  Use this file when using CLI.
  193. RESETTBE.BAT     This file resets the Car table to its intial state.
  194.                  Use this file when using Embedded SQL.
  195. MAKEFILE         This is the makefile used to build the sample application from
  196.                  the command line.
  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. CRTDB.BAT        This file creates a local DB2 database called DAXSAMP.
  201.                  You must run RESETTBE or RESETTBC after creating the local DB2
  202.                  database to create and populate the database tables.
  203.                  NOTE: If you are accessing a remote DB2 server, the database
  204.                        must be created on the remote server and cataloged on the
  205.                        local client.
  206. ESQL.MAK         Use this Make file is you are recreating the application from
  207.                  the command line and are using Embedded SQL.
  208. STOCKSOM.DAX     This file is used to regenerate the Data Access Builder files
  209.                  if you want to rebuild the sample.
  210. STOCKSOM.IWO     This file is used to store the options associated with the
  211.                  workframe project.
  212. STOCKSOM.IWP     This file is used to invoke the workframe project associated
  213.                  with this sample.
  214. BINDINGS.MAK     This file must be run before nmake on MAKEFILE or nmake on
  215.                  ESQL.MAK or before a workframe Build.
  216. README.TXT       This file.
  217.  
  218.  
  219.