All the example 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 example programs.
**
**
*/
#define USER "user"
#define PASSWORD "server_password"
#define LANGUAGE "us_english"
#define SQLBUFLEN 255
#define ERR_CH stderr
#define OUT_CH stdout
extern void error();
extern int err_handler();
extern int msg_handler();
All the examples except the data conversion example program contain these lines:
DBSETLUSER(login, USER);
DBSETLPWD(login, PASSWORD);
The changes made to the EX_USERNAME, EX_PASSWORD, and LANGUAGE variables include:
EX_USERNAME is defined in sybdbex.h as “user.” Before you run the example programs, you must edit sybdbex.h and change “user” to your server login name.
EX_PASSWORD is defined in sybdbex.h as “server_password.” Before you run the example programs, you may want to edit sybdbex.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” 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 “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.)
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 example program, exampl12.c, is the only example that references LANGUAGE.