import cx_Oracle

Andy Todd andy47 at halfcooked.com
Wed Nov 5 09:44:19 EST 2003


GrayGeek wrote:
> Waldemar Osuch wrote:
> 
> 
>>GrayGeek <jkrepsBEAR at FISHneb.rr.com> wrote in message
>>news:<PqDpb.109407$%C5.82494 at twister.rdc-kc.rr.com>...
>>
>>>Andy Todd wrote:
>>>
>>>
>>>>GrayGeek wrote:
>>>>
>>>>
>>>>>Uwe Hoffmann wrote:
>>>>>
>>>>>
>>>>>
>>>>>>GrayGeek wrote:
>>>>>>
>>>>>>
>>>>>>>Bernard Delmée wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>It gives me an error about being unable to find the OCISetDefault
>>>>>>>>>entry point in 'oci.dll'.
>>>>>>>>
>>>>>>>>cx_Oracle works on top of the regular oracle client, which you'll
>>>>>>>>need to install before it works. The OCI libraries are
>>>>>>>>parOCISetDefault t of that.
>>>>>>>
>>>>>>>
>>>>>>>I have it installed, and have used it to create webpages using
>>>>>>>Oracle's HTP.P function, and I also accessed tables on the Oracle9
>>>>>>>server from JDev9
>>>>>>>and from PLSQLDeveloper.   The oci.dll is in the Oracle Home/dll
>>>>>>>directory. As my first post indicated, cx_Oracle is able to see
>>>>>>>oci.dll, it just can't communicate with it properly.
>>>>>>>???
>>>>>>
>>>>>> i think that the binaries were built against another version of
>>>>>> oracle. i had a similar problem with DCOracle2 (versions 8.0.5 vs.
>>>>>> 8.1.7 or
>>>>>>7.3.3 vs. 8.0.5).
>>>>>> As far as i remember OCISetDefault was one of the problematic
>>>>>> symbols.
>>>>>
>>>>>
>>>>>I'm hoping that we can switch from Java to Python but since we are
>>>>>standardizing on Oracle having a reliable Python connection to Oracle
>>>>>9i is
>>>>>important.   mmm... Maybe I can use PostgreSQL for a proof of
>>>>>concept...
>>>>
>>>>Is $ORACLE_HOME/bin on your path? This is how cx_Oracle picks up the
>>>>oci.dll. Its not necessary for the Oracle toolks like JDeveloper and
>>>>SQL*Plus, but its essential for third party tools.
>>>
>>>Yes.  cx_Oracle has no problem finding oci.dll, it just can find the
>>>right 'entry point'.
>>>
>>>
>>>>You don't mention which version of Oracle you are using. There are
>>>>binaries for either Oracle 8i or 9i with Python 2.2 on the home page
>>>>(http://www.computronix.com/utilities.shtml#Oracle) but they won't work
>>>>with earlier versions of Oracle. Although, with a bit of luck and a
>>>>following wind the 8i binary can be used to access a 9i database (it
>>>>just can't do anything with the new features). But on the whole you
>>>>will be better off getting the appropriate driver for your database
>>>>version.
>>>
>>>I started using Python 2.3 and when I ran into this problem my first tack
>>>was to remove Python 2.3 and revert to Python 2.2, but Python 2.2 shows
>>>the
>>>same problem.  We use both Oracle 8i and Oracle 9i.  I am attempting to
>>>connect to my Oracle 9i database.  I have tried both binaries and the
>>>"import cx_Oracle" dies in both using Python 2.2 against Oracle 9i.
>>
>>I had similar problem once on a machine with two Oracle installations.
>>cx_Oracle was finding oci.dll all right but it was the wrong one.
>>When I found a machine with only one version of Oracle the problem
>>went away.
>>After this hurdle was over I had nothing but positive impressions from
>>using cx_Oracle module.
>>
>>waldemar
> 
> 
> mmm... the only Oracle onnection on my box is for the 9i database.
> 

So, just to clarify, on your Windows box you now have *only* Python 2.2 
and the Oracle 9i client? I'm presuming also that your database is on 
another machine. And you've installed the appropriate cx_Oracle binary? 
Works for me;

PythonWin 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au) - 
see 'Help/About PythonWin' for further copyright information.
 >>> import cx_Oracle
 >>> cx_Oracle.version
'3.1'
 >>> db=cx_Oracle.connect('andy/andy at melchett')
 >>> cursor=db.cursor()
 >>> cursor.execute("SELECT user FROM dual")
[<StringVar object at 0x012AAF08>]
 >>> print cursor.fetchall()
[('ANDY',)]
 >>>

I also tried it with cx_Oracle version 2.5a, and then on my other 
machine with Python 2.3, the 9i client and version 3.0a of cx_Oracle.

So, my guess is that you are still suffering from a DLL confusion 
(somewhere).

Regards,
Andy
-- 
--------------------------------------------------------------------------------
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/







More information about the Python-list mailing list