Help for DCOracle examples

Martin Franklin martin.franklin at westerngeco.com
Fri Jan 26 02:37:33 EST 2001


If this is Linux /UNIX

When running a a CGI script you may not have the enviroment variables
set
such as ORACLE_SID and ORACLE_HOME plus others like LD_LIBRARY_PATH etc.
to set these you will have to user os.environ see the docs.

Martin.

Joe Murray wrote:
> 
> On a related DCOracle note...
> 
> I am having problems Connecting to a database using DCOracle from a
> Python CGI script.  I get the following error in my httpd logs:
> 
> OCI_ERROR at oci_8.c:275
> Error while trying to retrieve text for error ORA-12545
> 
> A code snippet follows:
> 
>     try:
>         db = DCOracle.Connect('oracleuser/oraclepassword')
>         return HTMLgen.Paragraph('Connected to DB.')
>     except:
>         return HTMLgen.Paragraph('Connection to DB DENIED!')
> 
> Peculiar thing follows:
> 
> Script works from command line (ie, connects to OracleDB no problem).
> But not via browser... hmmm.  Is there some permissions problem I'm
> missing?
> 
> Thanks,
> 
> joe
> 
> Jose Martin wrote:
> >
> > import Buffer, oci_, sys <===   Error     Must Import DCOracle
> > dbc=Connect("weiming/weiming")
> > c=dbc.cursor()
> > --------------------------------------------------------------------
> >
> > try this...
> >
> > import DCOracle
> > dbc=DCOracle.Connect(connectstring)
> >
> > cur=dbc.cursor()
> >
> > cur.execute('SELECT TABLE_NAME FROM TABS')
> > res=cur.fetchall()
> >
> > for table in res:
> >         print table[0]
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> 
> --
> Joseph Murray
> Bioinformatics Specialist, AGY Therapeutics
> 290 Utah Avenue, South San Francisco, CA 94080
> (650) 228-1146
> 
> --
> http://mail.python.org/mailman/listinfo/python-list

-- 
Martin Franklin Interactive Software Support
Tel. Work 01234 224793, (Ext. 4793)
Western Geco, Manton Lane, Bedford, MK41 7PA
martin.franklin at westerngeco.com




More information about the Python-list mailing list