All of the sample programs reference the sample header file, sybdbex.h. The contents of sybdbex.h are as follows:
/*
** sybdbex.h
**
** This is the header file that goes with the
** Sybase DB-Library sample programs.
**
**
*/
#define USER "sa"
#define PASSWORD ""
#define LANGUAGE "us_english"
#define SQLBUFLEN 255
#define ERR_CH stderr
#define OUT_CH stdout
extern void error();
int CS_PUBLIC err_handler PROTOTYPE(( DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr));
int CS_PUBLIC msg_handler PROTOTYPE(( DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line));
All of the samples except Example 5 contain these lines:
DBSETLUSER(login, USER);
DBSETLPWD(login, PASSWORD);
Following are descriptions of the changes you can make for the lines in sybdbex.h:
USER is defined in sybdbex.h as “sa.” Before running the sample programs, you must edit sybdbex.h and change “sa” to your server login name.
PASSWORD is defined in sybdbex.h as null (“ ”) string. Before running the sample programs, edit sybdbex.h and change “server_password” to your server password. Choose one of the following options for PASSWORD:
Option 1: Change your server password to “server_password” while you are running the samples. This creates the possibility of a security breach, because while your password is set to this published value, an unauthorized person might take the opportunity to log in to the server as you. If this is a problem, choose one of the other options.
Option 2: In sybdbex.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. When you are finished with the sample, edit the line so that it again says “server_password.”
Option 3: In the sample programs, delete the DBSETLPWD line entirely, and substitute your own code to prompt users for their server passwords. (Because this code is platform-specific, Sybase does not supply it.)
LANGUAGE: If your server’s language is not U. S. English, edit the LANGUAGE line in sybdbex.h so that it is the same as the server’s. Example 12 is the only sample that references LANGUAGE.