[DB-SIG] Oracle, Python and CGI

Anthony Baxter Anthony Baxter <arb@connect.com.au>
Tue, 05 Aug 1997 11:43:38 +1000

>>> Cary Collett wrote
> I'm trying to access an Oracle DB from a Python script being called via
> CGI. When I tried to connect to Oracle, I got this error:
>     cobj = oracledb.oracledb('ffoo/bar')
> OracleDbError: LOGON caused a Error while trying to retrieve text for 
> error ORA-01019

This generally means you haven't set up the appropriate environment variables.

def oracle_env():
    """oracle_env - set the appropriate environment for Oracle"""
    import os
    # change the following!

    os.putenv("ORACLE_HOME", orahome)
    os.putenv("ORA_NLS",     orahome+"/ocommon/nls/admin/data")
    os.putenv("ORACLE_TERM", "xterm")
    os.putenv("ORACLE_SID",  "ink")
    os.putenv("ORACLE_DOC",  "/import/oracle/doc")

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org