All of the sample programs reference the example header file, example.h. The contents of example.h are as follows:
/*
** example.h
**
** This is the header file that goes with the Sybase
** Client-Library example programs.
*/
/*
** Define symbolic names, constants, and macros
*/
#define EX_MAXSTRINGLEN 255
#define EX_BUFSIZE 1024
#define EX_CTLIB_VERSION CS_VERSION_150
#define EX_BLK_VERSION BLK_VERSION_150
#define EX_ERROR_OUT stderr
#define EX_BADVAL (CS_INT)-1
#define EX_MAX_ARR 64
/*
** exit status values
*/
#define EX_EXIT_SUCCEED 0
#define EX_EXIT_FAIL 1
/*
** Define global variables used in all sample programs
*/
#define EX_SERVER NULL /* use DSQUERY env var */
#define EX_USERNAME "sa"
#define EX_PASSWORD ""
/*
** Uncomment the following line to test the HA Failover feature.
*/
/* #define HAFAILOVER 1 */
#define EX_SCREEN_INIT()
The changes made to EX_USERNAME and EX_PASSWORD include:
EX_USERNAME is defined in example.h as “sa.” Before you use the sample programs, you must edit example.h and change “sa” to your server login name.
EX_PASSWORD is defined in example.h as null (“ ”) string. Before you use the sample programs, you may want to edit example.h and change to your server password.
You have three options regarding EX_PASSWORD. Choose the one that best meets your needs:
Method 1 – Change your server password to null (“ ”) string for the duration of the time that you are running the examples. However, this method creates the possibility of a security breach. While your password is set to this published value, an unauthorized person could log in to the server as you. If this possibility presents a problem, choose one of the other methods of handling passwords for the sample programs.
Method 2 – In example.h, change the null (“ ”) string to your own server password. Use the operating system’s protection mechanisms to prevent others from accessing the header file while you are using it. After finishing the example, edit the line so that it reads “server_password” again.
Method 3 – In the sample programs, delete the ct_con_props code that sets the server password and substitute your own code to prompt users for their server passwords. (As this code is platform-specific, Sybase does not supply it.)