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 -> Re: OCI question -- if you have souls please help!

Re: OCI question -- if you have souls please help!

From: Joel Garry <joel-garry_at_home.com>
Date: 12 May 2003 15:29:03 -0700
Message-ID: <91884734.0305121429.1672dbd5@posting.google.com>


laredotornado_at_zipmail.com (D. Alvarado) wrote in message news:<9fe1f2ad.0305120956.170bb452_at_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."

Try ORACLE_SID instead of TWO_TASK. Just a thought. Also be sure you are setting ORACLE_HOME correctly, print it out from your program.

>
> 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 - 17:29:03 CDT

Original text of this message

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