home *** CD-ROM | disk | FTP | other *** search
- This directory contains the following DB-Library example files:
-
- example1.c: Submits 2 queries to the server on the table
- "sysobjects", one to find all the system tables,
- the other to find the first 10 stored procedures.
- Binds program variables to the returned rows, then
- displays the rows.
-
- example2.c: Opens a data file, inserts data from the file into
- a database table, binds the data to program variables,
- and displays the results.
-
- example3.c: Illustrates binding aggregate and compute by results
- using the "pubs" database.
-
- example4.c: Submits a query to the server and saves up to 1,000
- rows of the results using row buffering rather
- than binding. Asks the user which row to display,
- then displays that row.
-
- example5.c: Illustrates data conversion with the dbconvert()
- routine.
-
- example6.c: Demonstrates the use of two DBPROCESSes to
- simultaneously query and update a table through
- browse mode. This example uses a hardcoded query.
-
- example7.c: Demonstrates most of the browse mode routines
- that deal with finding out about the results
- of an ad hoc query.
-
- example8.c: Illustrates how to use remote procedure calls
- and how to process return parameter values.
-
- twophase.c: Illustrates the use of the two-phase commit
- service to perform a distributed transaction.
-
- datafile: The data file for examples 2 and 6.
-
- makefile.os2: Compiles and links the examples for OS/2.
-
- makeall.bat: Compiles and links the examples for DOS.
-
- README: This file.
-
-
- Compiling the Examples
-
- The files that build the example executables assume that you
- have installed the C run time libraries with fully qualified
- names (i.e. llibcep or llibcer, not llibce).
-
- Building DOS Executables
-
- To compile all the example programs, type:
-
- makeall
-
- You may compile and link examples individually by entering
- single lines from the makeall.bat file on the command line.
-
- The makeall batch file has been set up for the MSC 6.0
- compiler. It may be necessary to make changes if compiling
- with a different version.
-
- Building OS/2 Executables
-
- To compile all the example programs, type:
-
- nmake makefile.os2
-
- To compile one at a time, type:
-
- nmake -f makefile.os2 example1
- nmake -f makefile.os2 example2
- ...
-
- Makefile Definitions
-
- The first several lines of the makefile contain definitions
- for directories and libraries. You should edit the makefile
- and insure that the definitions are appropriate for your
- environment. For example:
-
- #
- SYBASE = c:\sql
- INCDIR = $(SYBASE)\include
-
- If SYBASE has been installed in a different directory structure
- than c:\sql, you must change the SYBASE definition
- accordingly or the examples will not compile.
-
- The makefile has been set up for the MSC 6.0 compiler. It may be
- necessary to make changes if compiling with a different version.
-
-
-
- Running the Examples
-
- To run the examples, type:
- example1
- example2
- ...
-
- Notes:
-
- Make sure Net-Library is configured correctly.
-
- Make sure the SYBASE environment variable is defined properly.
-
- Make sure the SYBUSER environment variable is set to be your
- SQL Server user name.
-
- Change your password to "server_password", because the example
- programs use "server_password" to log in to the server.
-
- Be sure that you have create database permission; Example 2
- creates a database "test".
-
- You'll need the "pubs" database installed to run Example 3 and
- the two-phase commit example. You need select permission on tables
- in the "pubs" database for Example 3. You need update permission
- on the titles table in the "pubs" databases on both SQL Servers
- used in the two-phase commit example.
-
- Example 6 creates the table "alltypes" in your default database,
- and requires create table permission on that database.
-
- Example 7 prompts the user for an ad hoc query. Notice that the
- results differ depending on whether the SELECT query includes
- the keywords FOR BROWSE and whether the table SELECTed is browsable.
-
- Example 8 assumes you have created the stored procedure
- "rpctest" in your default database. The comments at the top
- of the Example 8 source code specify the CREATE PROCEDURE statement
- necessary for creating "rpctest". You must have execute permission
- for "rpctest". This example requires SQL Sever 4.0 or higher.
-
- The two-phase commit example requires two servers, each of which
- must contain the "pubs" database. Make sure that your password
- on both of the servers is "server_password". See Section 3 of the
- DB-Library Reference Supplement for a complete description of the
- requirements for running this example.
-
- The programs are well commented; take a look before you run
- them if you'd like more details.
-
-
-