The following example connects to the server SYBASE using the password “passes.”
exec sql begin declare section;
CS_CHAR user[16];
CS_CHAR passwd[16];
CS_CHAR server[BUFSIZ];
exec sql end declare section;
strcpy(server,"SYBASE");
strcpy(passwd,"passes");
strcpy(user, “my_id”);
exec sql connect :user identified by :passwd using
:server;