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

Home -> Community -> Usenet -> c.d.o.server -> OCI question -- if you have souls please help!

OCI question -- if you have souls please help!

From: D. Alvarado <laredotornado_at_zipmail.com>
Date: 12 May 2003 10:56:29 -0700
Message-ID: <9fe1f2ad.0305120956.170bb452@posting.google.com>


Hi,

   I am trying to write an Apache module (running on a Solaris machine) that will connect to my Oracle 8.1.7 database. I am using some of the C libraries that came with Oracle, but I can't seem to connect to the db, which is running on a different machine than Apache. I repeatedly get the error: "ORA-01034: ORACLE not available."

Here's some of the code:

/* Set some environment variables */
        two_task = (char *)ap_palloc(r->pool,15 + strlen(sec->auth_ora8_two_task));

        sprintf(two_task,"TWO_TASK=%s",sec->auth_ora8_two_task);
        putenv(two_task);


/* Try and connect to db. */
if (orlon(&lda,hda,(text*)sec->auth_ora8_uid_login,-1,(text*)sec->auth_ora8_pwd_login,-1,0)) { ap_log_error(APLOG_MARK, APLOG_NOTICE, NULL, "Failed to log on."); text msg[512]; oerhms(&lda, lda.rc, msg, (sword) sizeof msg); msg[strlen(msg) - 1] = 0; sprintf(ora8_errstr,"ORA8: Could not connect to Oracle8(%s)
as %s : %s",(sec->auth_ora8_two_task) ? sec->auth_ora8_two_task : se c->auth_ora8_sid ,sec->auth_ora8_uid_login,msg);
          return NULL;
        }

I have tried numerous things for the connect string, but nothing works! Some of the things I've tried are:

T:hostname:port:tnsname
hostname:port:tnsname
T:hostname:tnsname
hostname:tnsname
tnsname

I can connect to Oracle fine through sql*plus on the same machine from which I'm trying to connect through C. Does anyone know how the connect string should be properly formed?

Thanks, Dave Received on Mon May 12 2003 - 12:56:29 CDT

Original text of this message

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