
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 "pubs2" 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.

	example9.c:	Uses the au_pix table in the "pubs2" database
		        to show the basic outline of how to use the text
			and image routines in DB-Library.

	example10.c:	Illustrates how to insert arbitrarily large image 
			data into the "pubs2" database.

	example11.c:	Illustrates how to retrieve arbitrarily large image 
			data from the "pubs2" database.
	
	example12.c:	Illustrates how to use many of the international 
			features of DB-Library, including changing
			language, using the appropriate date format,
			and using the server's sort order.

	bulkcopy.c:	Illustrates the use of the bulk copy special
			library by performing a bulk copy from program
			variables into a database table.

	twophase.c:	Illustrates the use of the two-phase commit
			service to perform a distributed transaction.

	sybdbex.h:	The header file for the examples.

	datafile:	The data file for examples 2 and 6.

	imagefile:	An image file for example 10.

	bcpdata.in:	The data file for the bulk copy example.

	makefile:	Compiles the examples.

	README:		This file.


Making and Running the Examples:

Before running an example, read through the code so that you understand what
the program will do. To make and run an example, perform the following steps:

 1.	Verify that you have a user account on an available Adaptive Server
	and that you have 'create database' permission. Example 2
	creates the database "test", and the bulk copy example creates
	the database "example_bcp".

 2.	Make sure that the following environment variables are set correctly:

        $SYBASE is set to the full pathname of the Sybase root directory.

	$SYBASE_OCS is set to the directory where the Open Client
		    product is installed (e.g. OCS-15_0).
	
        $SYBPLATFORM is set to the Sybase abbreviation for your platform name.
		This is required by the example make file. Legal values are listed below.

		hpia                    - 32bit HP IPF HP-UX B.11.22
		hpia64                  - 64bit HP IPF HP-UX B.11.22
		hpux                    - HP 9000 HP-UX B.11
		hpux64                  - 64bit HP 9000 HP-UX B.11

		sgi                     - SGI (compiled with -n32)
		sgi64                   - SGI (compiled with -64)

		rs6000                  - IBM RISC System 6000
		rs600064                - IBM RISC System 6000 (64bit)

		sun_svr4                - Sun Solaris SPARC
		sun_svr464              - 64bit Sun Solaris SPARC

		axposf                  - Digital Unix

		linux                   - Linux Intel x86 (32bit)
		linuxamd64              - Linux Intel/AMD x86_64 (64bit)
		linuxia64               - Linux Intel ia64 (64bit)

		ibmplinux		- Linux IBM P Series (32bit)
		ibmplinux64		- Linux IBM P Series (64bit)

		macosx                  - Mac OS X 

		sunx86                  - Sun Solaris x86 

		sunx8664		 - 64bit Sun Solaris x86

	$DSQUERY is set to the name of the server that the examples connect to.

        The library path environment variable. Depending on your platform, 
	use the following (example for Sun Solaris):

		C-shell:
		setenv LD_LIBRARY_PATH ${SYBASE}/${SYBASE_OCS}/lib
		
		Bourne/Korn shell:
		LD_LIBRARY_PATH=${SYBASE}/${SYBASE_OCS}/lib
		export LD_LIBRARY_PATH 

	Note 1: Refer to your operating sytem documentation for the
		name of the library path envirmonment variable.
		(E.g. on hpux, use SHLIB_PATH)

	Note 2: Some platforms (sun_svr4, hpux) require /usr/ccs/bin
		in your path.

	Note 3: Some platforms (such as rs6000) require /usr/lib in your
		LD_LIBRARY_PATH

 3.	Edit the sybdbex.h header file to reflect your Adaptive Server
	username and password.

 4.	Build the example. A makefile is provided.

	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. The default setting is to build the examples
	in 32-bit non-debug mode.

	INCDIR    = $(SYBASE)/$(SYBASE_OCS)/include
	LIBDIR    = $(SYBASE)/$(SYBASE_OCS)/lib

	To build all the example programs, type:

		make all

	To build an induvidual example, type:
		make example1
		make example2
		   ...

	To run the examples, type:
		example1
		example2
		   ...


Notes:

	You'll need the "pubs2" database installed to run Examples 3,
	10, 12 and 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 grant execute
	permission for "rpctest".

	Example 10 prompts for an author id and the name of a file 
	containing an image.  The author id must be of the form
	"000-00-0000", like a social security number.  "imagefile", 
	provided with the sample code, contains an image.
	To run this example, you'll need insert permission on the
	"au_pix" table in the "pubs2" database.

	Example 12 shows how to use the international features with a
	server whose language is us_english.  For other languages, modify the
	LANGUAGE variable in sybdbex.h and the list of short month names
	in example12.c, lines 304-309.  You'll need the "pubs2" 
	database installed to run Example 12.

	The bulk copy example creates the database "example_bcp" and
	the table "alltypes" in that database.  To run this example,
	you'll need create database and create table permission.

	The two-phase commit example requires two servers, each of which 
	must contain the "pubs2" database.  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.
