Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> ProC Help!
I have developed an Application that issues an EXEC SQL CONNECT statement to
connect to a non default oracle node (database) but I´m experiencing the
following problem:
Assuming that I connect to Oracle using the following C/ProC function:
int conectDB(char *db,char *dbid,char *usr,char *pass)
{
char sAuxString[100]="";
#ifdef ORACLE
EXEC SQL BEGIN DECLARE SECTION;
#endif
char sql_db_string[41]=""; char sql_db_name[41]=""; char sql_username[41]=""; char sql_password[41]="";
#ifdef ORACLE
EXEC SQL END DECLARE SECTION;
#endif
strcpy(sql_db_string,db); strcpy(sql_db_name,dbid); strcpy(sql_username,usr); strcpy(sql_password,pass);
#ifdef ORACLE
EXEC SQL WHENEVER SQLERROR GOTO err_connect;
EXEC SQL CONNECT :sql_username IDENTIFIED BY :sql_password AT :sql_db_name
USING :sql_db_string;
#endif
return(OK);
err_connect:
sprintf(sAuxString,
"Error en la Conexion DBNAME: %s, DBSTRING: %s, USUARIO: %s, PASSWORD: %s",
sql_db_name,sql_db_string,sql_username,sql_password);
verifica_tran(sAuxString);
return(ERROR);
}
while the program runs just OK, I have found that if the environment
variable ORACLE_HOME is reset or set to an invalid oracle directory the
program stops connecting.
¿Is there any way to program to be environment-less? I do want to make the
connection without having to set the environment variable (SUN Platform)
Thanks,
Fedro
Received on Mon Apr 05 1999 - 21:27:00 CDT