home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a063 / 9.img / SAMPLE / DBLIB / README < prev    next >
Encoding:
Text File  |  1991-01-22  |  4.8 KB  |  149 lines

  1. This directory contains the following DB-Library example files:
  2.  
  3.     example1.c:    Submits 2 queries to the server on the table
  4.             "sysobjects", one to find all the system tables,
  5.             the other to find the first 10 stored procedures.
  6.             Binds program variables to the returned rows, then
  7.             displays the rows.
  8.  
  9.     example2.c:    Opens a data file, inserts data from the file into
  10.             a database table, binds the data to program variables,
  11.             and displays the results.
  12.  
  13.     example3.c:    Illustrates binding aggregate and compute by results
  14.             using the "pubs" database.
  15.  
  16.     example4.c:    Submits a query to the server and saves up to 1,000
  17.             rows of the results using row buffering rather
  18.             than binding. Asks the user which row to display,
  19.             then displays that row.
  20.  
  21.     example5.c:    Illustrates data conversion with the dbconvert()
  22.             routine.
  23.  
  24.     example6.c:    Demonstrates the use of two DBPROCESSes to
  25.             simultaneously query and update a table through
  26.             browse mode.  This example uses a hardcoded query.
  27.  
  28.     example7.c:    Demonstrates most of the browse mode routines
  29.             that deal with finding out about the results
  30.             of an ad hoc query.
  31.  
  32.     example8.c:    Illustrates how to use remote procedure calls
  33.             and how to process return parameter values.
  34.  
  35.     twophase.c:    Illustrates the use of the two-phase commit
  36.             service to perform a distributed transaction.
  37.  
  38.     datafile:    The data file for examples 2 and 6.
  39.  
  40.     makefile.os2:    Compiles and links the examples for OS/2.
  41.  
  42.     makeall.bat:    Compiles and links the examples for DOS.
  43.  
  44.     README:        This file.
  45.  
  46.  
  47. Compiling the Examples
  48.  
  49.     The files that build the example executables assume that you
  50.     have installed the C run time libraries with fully qualified
  51.     names (i.e. llibcep or llibcer, not llibce).
  52.  
  53. Building DOS Executables
  54.  
  55.     To compile all the example programs, type:
  56.  
  57.         makeall
  58.  
  59.     You may compile and link examples individually by entering
  60.     single lines from the makeall.bat file on the command line.
  61.  
  62.     The makeall batch file has been set up for the MSC 6.0
  63.     compiler.  It may be necessary to make changes if compiling
  64.     with a different version.
  65.  
  66. Building OS/2 Executables
  67.  
  68.     To compile all the example programs, type:
  69.  
  70.         nmake makefile.os2
  71.  
  72.     To compile one at a time, type:    
  73.  
  74.         nmake -f makefile.os2 example1   
  75.         nmake -f makefile.os2 example2    
  76.            ...
  77.  
  78.     Makefile Definitions
  79.  
  80.     The first several lines of the makefile contain definitions
  81.     for directories and libraries. You should edit the makefile
  82.     and insure that the definitions are appropriate for your
  83.     environment. For example:
  84.  
  85.     #
  86.     SYBASE    = c:\sql
  87.     INCDIR    = $(SYBASE)\include
  88.  
  89.     If SYBASE has been installed in a different directory structure
  90.     than c:\sql, you must change the SYBASE definition
  91.     accordingly or the examples will not compile.
  92.  
  93.     The makefile has been set up for the MSC 6.0 compiler.  It may be
  94.     necessary to make changes if compiling with a different version.
  95.         
  96.  
  97.  
  98. Running the Examples
  99.  
  100.     To run the examples, type:
  101.         example1
  102.         example2
  103.            ...
  104.  
  105. Notes:
  106.  
  107.     Make sure Net-Library is configured correctly.
  108.  
  109.     Make sure the SYBASE environment variable is defined properly.
  110.  
  111.     Make sure the SYBUSER environment variable is set to be your 
  112.     SQL Server user name.
  113.  
  114.     Change your password to "server_password", because the example 
  115.     programs use "server_password" to log in to the server. 
  116.  
  117.     Be sure that you have create database permission; Example 2
  118.     creates a database "test".
  119.  
  120.     You'll need the "pubs" database installed to run Example 3 and
  121.     the two-phase commit example.  You need select permission on tables
  122.     in the "pubs" database for Example 3.  You need update permission
  123.     on the titles table in the "pubs" databases on both SQL Servers
  124.     used in the two-phase commit example.
  125.  
  126.     Example 6 creates the table "alltypes" in your default database,
  127.     and requires create table permission on that database.
  128.  
  129.     Example 7 prompts the user for an ad hoc query.  Notice that the
  130.     results differ depending on whether the SELECT query includes 
  131.     the keywords FOR BROWSE and whether the table SELECTed is browsable.
  132.  
  133.     Example 8 assumes you have created the stored procedure 
  134.     "rpctest" in your default database.  The comments at the top 
  135.     of the Example 8 source code specify the CREATE PROCEDURE statement 
  136.     necessary for creating "rpctest".  You must have execute permission 
  137.     for "rpctest".  This example requires SQL Sever 4.0 or higher.
  138.  
  139.     The two-phase commit example requires two servers, each of which 
  140.     must contain the "pubs" database.  Make sure that your password 
  141.     on both of the servers is "server_password".  See Section 3 of the 
  142.     DB-Library Reference Supplement for a complete description of the 
  143.     requirements for running this example.
  144.  
  145.     The programs are well commented; take a look before you run
  146.     them if you'd like more details.
  147.  
  148.  
  149.