Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ProC Help!

ProC Help!

From: Ing. Fedro E. Ponce de Leon L. <fedro_at_ccc.cnart.mx>
Date: Mon, 5 Apr 1999 20:27:00 -0600
Message-ID: <7ebr1o$d4k$1@enya.fciencias.unam.mx>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US