All of the example 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. *****///* Sccsid %Z% %M% %I% %G% *//*** Define symbolic names, constants, and macros*/#define EX_MAXSTRINGLEN 255
#define EX_BUFSIZE 1024
#define EX_CTLIB_VERSION CS_VERSION_125
#define EX_BLK_VERSION BLK_VERSION_125
#define EX_ERROR_OUT stderr/*** exit status values*/#ifdef vms
#include <stsdef.h>
#define EX_EXIT_SUCCEED (STS$M_INHIB_MSG | STS$K_SUCCESS)
#define EX_EXIT_FAIL (STS$M_INHIB_MSG | STS$K_ERROR)#else#define EX_EXIT_SUCCEED 0
#define EX_EXIT_FAIL 1
#endif /* vms *//*** 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 *//*** For some platforms (e.g. windows 3.1), additional work needs to be done
** to insure that the output of some of the example programs can be displayed.
** QuickWin's standard output screen buffer to unlimited size. */#if QWIN#define EX_SCREEN_INIT() _wsetscreenbuf(_fileno(stdout), _WINBUFINF)#else /* QWIN */#define EX_SCREEN_INIT() #endif /* QWIN */
** This macro will insure that any setup is done for the platform.**** For windows, _wsetscreenbuf(_fileno(stdout), _WINBUFINT) will set
The changes made to EX_USERNAME and EX_PASSWORD include:
EX_USERNAME is defined in example.h as “user.”. Before you use the example programs, you must edit example.h and change “user” to your server login name.
EX_PASSWORD is defined in example.h as “server_password.” Before you use the example programs, you may want to edit example.h and change “server_password” 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 “server_password” 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 example programs.
Method 2 – In example.h, change the string “server_password” 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. When you are finished with the examples, edit the line so that it again reads “server_password.”
Method 3 – In the example programs, delete the ct_con_props code that sets the server password and substitute your own code to prompt users for their server passwords. (Because this code is platform-specific, Sybase does not supply it.)