Re: CGI AND PROC

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/05/29
Message-ID: <338cd086.1720403_at_newshost>#1/1


On Wed, 28 May 1997 01:46:01 -0700, Vincent GEANNIN <p9408_at_bigiup.univ-lemans.fr> wrote:

>Hello,
> I try to develop a CGI with PRO C for getting data from an oracle
>database.
> I have two question :
>
> - I use this line to connect to the database :
> EXEC SQL DECLARE DB_NAME DATABASE ;
> EXEC SQL CONNECT :username IDENTIFIED BY :password at DB_NAME
>USING :db_string ;
> but when I execute the CGI, I have this error
> ORACLE error-- Error while trying to retrieve text for error ORA-12154
>

cgi-bin programs run in a 'clean' environment. This environment will be missing important things like...

  • ORACLE_HOME
  • ORACLE_SID (maybe important, maybe not)

You need to get these into the environment of the webserver and get them passed through to cgi-bin programs. The method for doing this varies from webserver to webserver.

To see what is in the environment, put a small script like:

#!/bin/sh

echo Content-Type: text/plain
echo
env

Into your cgi-bin directory and run it. See whats missing that is in your normal environment. To see what you need, you can always use a small sh script like:

#!/bin/sh

ORACLE_HOME=/usr/oracle
export ORACLE_HOME

exec YourCgiBinProgram

Add appropriate environment variables till it works.

> (REM this lines work well with a non cgi programe)
>
> - The other problem is that the size of the cgi program is 4Mo
> My Makefile is maybe Bad, so does someone have a good
>Makefile for develop cgi programme with proc.
>

If you have version 7.3, you have shared object libs you can use instead of statically linking. You would just need to link in libclntsh.so from $ORACLE_HOME/lib instead of the other oracle libs. If you do this though, bear in mind you will need the environment variable LD_LIBRARY_PATH set so it can find the library at run time.. (another variable to make sure your webserver is passing through)

>Thanks, GEANNIN Vincent

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu May 29 1997 - 00:00:00 CEST

Original text of this message