Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!seismo!beno.CSS.GOV From: jean@beno.CSS.GOV (Jean Anderson) Newsgroups: comp.databases Subject: Re: Oracle TWO_TASK Message-ID: <49392@seismo.CSS.GOV> Date: 2 Feb 91 01:31:44 GMT Sender: usenet@seismo.CSS.GOV Organization: SAIC Geophysics Division, San Diego CA Lines: 50 In article <1991Jan24.033628.20710@infonode.ingr.com> tensmekl@infonode.ingr.com (Kermit Tensmeyer) writes: >> >>The Unix Environment variable TWO_TASK determines the "default" device >> ... >>This all works well with SQL*Plus SQL*Forms imp exp and sqldba. However, >>this kind of default action doesn't seem to effect the default connect >>under Pro*C. Is there some call or parameters to Pro*C Exec SQL that will > In <1585@doitcr.doit.sub.org> hthoene@doitcr.doit.sub.org (Hermann Thoene): >You **must** change your C code to evalute the Environment variable >TWO_TASK with the getenv() call in C. It is left to the application (here >to your PRO*C program) to build the connect string together. So just check >up whether TWO_TASK is set and append the string to the connect string >given to your program. We use TWO_TASK to connect to remote databases with PRO*C and PRO*FORTRAN applications and have never had to append the TWO_TASK information to the database connect string. Occasionally, however, some poor soul doesn't have his/her environment set up properly. To head this confusion off at the pass, we include something like the following in our dbopen routine before we even try to do the connect: uidptr=strchr(uid, '@'); /* Is sqlnet info explicitely in uid? */ if(uidptr == NULL) /* sqlnet info not in uid */ { p=getenv("TWO_TASK"); /* Is TWO_TASK set? */ if(p == NULL) /* TWO_TASK not set */ { p=getenv("ORACLE_SID"); /* Is ORACLE_SID set? */ if(p == NULL) /* ORACLE_SID not set */ { fprintf(stderr,"Database environment not set up--see your DBA\n"); return(BADDATA); } } } I periodically get email: "Uh, what do I need to do to set my environment up for the database?" - Jean Anderson DBA, SAIC Geophysics Division jean@seismo.css.gov -or- jean@esosun.css.gov (619)458-2727 +++++++++++++++++++++++++++++++++++++++++++++++++ ++ Any opinions are mine, not my employer's. ++ +++++++++++++++++++++++++++++++++++++++++++++++++