All the sample programs reference the example 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 the sample programs except the data conversion sample program contain these lines:
DBSETLUSER(login, USER);
DBSETLPWD(login, PASSWORD);
The changes made to the USER, PASSWORD, and LANGUAGE variables include:
USER is defined in sybdbex.h as “sa.” Before you run 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 you run the sample programs, you may want to edit sybdbex.h and change to your server password.
You have three options regarding PASSWORD. Choose the one that best meets your needs:
Method 1 – Change your server password to “” while 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 into the server as you. If this possibility presents a problem, choose one of the other methods.
Method 2 – In sybdbex.h, change the 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 examples, edit the line so that it again reads “server_password.”
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. (Because this code is platform-specific, Sybase does not supply it.)
LANGUAGE is defined in sybdbex.h as “us_english.” If your server’s language is not “us_english,” you may want to edit sybdbex.h and change “us_english” to your server’s language. The international languages routine sample program, exampl12.c, is the only example that references LANGUAGE.