Example programs

The following example programs and header files are installed with Client-Library. Each file contains a header describing the file’s contents and purpose. See the readme file for a complete description of each example program.

Example program

Description

blktxt.c

Uses the bulk copy routines to copy static data to a table.

compute.c

Shows how to send a Transact-SQL command and process compute and regular results.

csr_disp.c

Demonstrates the use of a read-only cursor.

ex_alib.c ex_amain.c

A collection of routines that form an example of how to write an asynchronous layer on top of Client-Library.

example.h

A header file for the Client-Library example programs.

exasync.h

Sends a language command and processes the results asynchronously. A header file for the constants and data structures in ex_alib.c and ex_amain.c.

exconfg.c

Shows how to set CS_SERVERNAME property value through the default external configuration file: $SYBASE/config/ocs.cfg.

exutils.c

Contains utility routines used by all of the other sample programs, and demonstrates how an application can hide some of the implementation details of Client-Library from higher-level programs.

exutils.h

A header file for the utility functions in exutils.c.

firstapp.c

This sample connects to a server, sends a select query, and prints the rows.

getsend.c

Shows how to retrieve and update text data.

i18n.c

Demonstrates some of the international features available in Client-Library.

multithrd.c

Demonstrates techniques for coding a multithreaded client application with Client Library.

NoteThis sample is coded for use with Solaris native threads package, and DCE pthread APIs.

rpc.c

Illustrates sending an RPC command to a server and then processing the row, parameter, and status results returned from the remote procedure.

secct_dec secct_krb

Demonstrates how to use networked-based security with DCE or CyberSAFE Kerberos.

usedir.c

Illustrates searching for servers that are available to connect to.

Before building and running an example, you must make sure the server and the client application environment are set up properly. In addition, you may want to change the user name with which the example is connecting to the server. See the Open Client and Open Server Programmer’s Supplement for instructions.