473,472 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

installing cx_Oracle

I can't get this configuration working:
cx_Oracle 4.0.1
Oracle 8.0.6
Python 2.3.3
Win NT4.0 SP6fc

My first shot at the problem was just running the installation thingie
pre-built for win32/python2.3/Oracle8i. It installed with no complaints but
I can't import the module (can't find OCIEnvCreate entry point in the
OCI.dll library).
This version was built for Oracle 8.1.7, so I figure that must be the
problem.

Then I downloaded the sources, but can't build them. After a fair amount of
fiddling with setup.py and some of the C header files to compensate for the
unusual file structure of my Oracle Client installation and for the use of
the gcc compilator instead of Visual Studio, I got stuck at this point:

:>python setup.py -build -c mingw32 install
:running build
:running build_ext
:building 'cx_Oracle' extension
:D:\minGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Id:\orant\oci80\include
:-Id:\orant\rdbms80\demo -ID:\Python23\include -ID:\Python23\PC -c
:cx_Oracle.c -o build\temp.win32-2.3\Release\cx_oracle.o
:"-DBUILD_TIME="""June 04, 2004 16:42:10"""
:In file included from cx_Oracle.c:63:
:Environment.c: In function `Environment_New':
:Environment.c:78: warning: implicit declaration of function `OCIEnvCreate'
:[follows a bunch of declaration errors for anything that's named
:OCIwhatever]
According to the Oracle Docs, "OCIEnvCreate creates and initializes an
environment for OCI functions to work under".

So my uneducated guess is that this OCIEnvCreate function is not present in
Oracle 8.0.6, but I can't find anything in the docs that hints to it.
1. Is there a way around this OCIEnvCrete problem?

2. Is there an alternative to cx_Oracle that works out of the box with
Oracle 8.0.6? (tryed DCOracle2, but couldn't make it work with Python2.3
AND without Zope)

3. Should I give up cx_Oracle and stick with ODBC?

4. Should I give up python and stick with Access VBA? (sorry, bad joke)

Any insight would be helpful (even another forum where I could forward this
specific question).

Thanks in advance,
Rodrigo Daunaravicius
Jul 18 '05 #1
8 6248
Rodrigo Daunaravicius wrote:
3. Should I give up cx_Oracle and stick with ODBC?

4. Should I give up python and stick with Access VBA? (sorry, bad joke)


Sorry this doesn't answer your questions, but since you're on Windows,
you may want to use one of the ADO wrappers for Python ... if you can't
get this working

David
Jul 18 '05 #2

Rodrigo Daunaravicius wrote:
I can't get this configuration working:
cx_Oracle 4.0.1
Oracle 8.0.6
Python 2.3.3
Win NT4.0 SP6fc

My first shot at the problem was just running the installation thingie
pre-built for win32/python2.3/Oracle8i. It installed with no complaints but
I can't import the module (can't find OCIEnvCreate entry point in the
OCI.dll library).
This version was built for Oracle 8.1.7, so I figure that must be the
problem.

Then I downloaded the sources, but can't build them. After a fair amount of
fiddling with setup.py and some of the C header files to compensate for the
unusual file structure of my Oracle Client installation and for the use of
the gcc compilator instead of Visual Studio, I got stuck at this point:

:>python setup.py -build -c mingw32 install
:running build
:running build_ext
:building 'cx_Oracle' extension
:D:\minGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Id:\orant\oci80\include
:-Id:\orant\rdbms80\demo -ID:\Python23\include -ID:\Python23\PC -c
:cx_Oracle.c -o build\temp.win32-2.3\Release\cx_oracle.o
:"-DBUILD_TIME="""June 04, 2004 16:42:10"""
:In file included from cx_Oracle.c:63:
:Environment.c: In function `Environment_New':
:Environment.c:78: warning: implicit declaration of function `OCIEnvCreate'
:[follows a bunch of declaration errors for anything that's named
:OCIwhatever]
According to the Oracle Docs, "OCIEnvCreate creates and initializes an
environment for OCI functions to work under".

So my uneducated guess is that this OCIEnvCreate function is not present in
Oracle 8.0.6, but I can't find anything in the docs that hints to it.
1. Is there a way around this OCIEnvCrete problem?

2. Is there an alternative to cx_Oracle that works out of the box with
Oracle 8.0.6? (tryed DCOracle2, but couldn't make it work with Python2.3
AND without Zope)

3. Should I give up cx_Oracle and stick with ODBC?

4. Should I give up python and stick with Access VBA? (sorry, bad joke)

Any insight would be helpful (even another forum where I could forward this
specific question).

Thanks in advance,
Rodrigo Daunaravicius


I had the same problem trying to connect to an Oracle 8.0.5 database.
The cx_Oracle binary was compiled for Oracle 8i/9i, and it didn't work
with the Oracle 8.0.5 OCI (Oracle Call Interface). Neither did the
source (I think it's designed to connect to an 8i/9i OCI, different from
an 8.0 OCI).
The solution (for me):

I installed an Oracle 8i client in another ORACLE_HOME in the same
Windows box, and modified the PATH environment variable to put the BIN
directory of the (new) Oracle 8i ORACLE_HOME before the BIN directory of
the (old) Oracle 8.0.5 ORACLE_HOME. So, when the cx_Oracle binary looks
for the OCI, it finds the Oracle8i installation and connects to the
database.

From your post, it's not clear to me if you have an Oracle 8.0.6 server
in your machine, or not. Maybe an Oracle server installation does not
like the Oracle 8i client installation and the PATH modification that I
suggest.

Hope this helps

Aurelio
Jul 18 '05 #3
Rodrigo Daunaravicius wrote:
According to the Oracle Docs, "OCIEnvCreate creates and initializes an
environment for OCI functions to work under".

So my uneducated guess is that this OCIEnvCreate function is not present in
Oracle 8.0.6, but I can't find anything in the docs that hints to it.
1. Is there a way around this OCIEnvCrete problem?
From
http://www.csee.umbc.edu/help/oracle...unc.htm#543147 OCIEnvCreate()

This call creates an environment for all the OCI calls using the modes specified by the user. This call should be invoked before any other OCI call and should be used instead of the OCIInitialize() and OCIEnvInit() calls. OCIInitialize() and OCIEnvInit() calls will be supported for backward compatibility.


If you really need to get it working with 8.0.x libraries, you could try
converting the call to OCIInitialize() and OCIEnvInit() calls.
You'll need to replace OCITerminate with OCIHandleFree.
In my experience these are the two main changes between 8.0.x and 8.1
You might find some help from the cx_Oracle authors, but the oracle docs
are fairly good.
Here is some code from a C++ database class that supports either
(tryimportOCIProc and importedOCIProc and importOCIProc are macros that
do dynamic function resolving, you should get the general idea)

tryimportOCIProc(OCIEnvCreate, sword, (OCIEnv **envp, ub4 mode, dvoid
*ctxp,
dvoid *(*malocfp)(dvoid *ctxp, size_t size),
dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr, size_t newsize),
void (*mfreefp)(dvoid *ctxp, dvoid *memptr),
size_t xtramem_sz, dvoid **usrmempp));

if (!importedOCIProc(OCIEnvCreate))
{
importOCIProc(OCIInitialize, sword, (ub4 mode, CONST dvoid *ctxp,
CONST dvoid *(*malocfp)(dvoid *ctxp, size_t size),
CONST dvoid *(*ralocfp)(dvoid *ctxp, dvoid *memptr,size_t newsize),
CONST void (*mfreefp)(dvoid *ctxp,dvoid *memptr)));
importOCIProc(OCIEnvInit, sword, (OCIEnv **envhpp, ub4 mode,
size_t xtramemsz, dvoid **usrmempp));

if (envhp == 0)
{
OCIInitialize(OCI_THREADED, 0, 0, 0, 0);
OCIEnvInit(&envhp, OCI_DEFAULT, 100, &testmem);
}
// AfxMessageBox("Using OCI 8.0",MB_OK);
}
else
{
if (envhp == 0)
OCIEnvCreate(&envhp, OCI_THREADED, 0, 0, 0, 0, 0, 0);
}
Jul 18 '05 #4

On Fri, 04 Jun 2004 22:11:06 +0200, David Fraser wrote:
If you really need to get it working with 8.0.x libraries, you could try
converting the call to OCIInitialize() and OCIEnvInit() calls.
You'll need to replace OCITerminate with OCIHandleFree.
In my experience these are the two main changes between 8.0.x and 8.1
You might find some help from the cx_Oracle authors, but the oracle docs
are fairly good.


Thanks, David. I successfully replaced the OCIEnvCreate() call, but still
had problems with OCILobCreateTemporary(), OCILobFreeTemporary(),
OCIUserCallbackRegister(), OCIUserCallbackGet(), OCI_UCBTYPE_ENTRY,
OCI_UCBTYPE_EXIT and OCI_UCBTYPE_REPLACE. This amount of patchwork from my
inexperienced hands would be asking for trouble, even if I could get it
compiled.
An 8i installation, as Aurelio suggested, is unfortunately not an option.
I'm now looking into ADO. I think it can fit the bill for my current
project, though I'd prefer to use the python DB API 2.0.

Rodrigo

Jul 18 '05 #5
Rodrigo Daunaravicius wrote:
On Fri, 04 Jun 2004 22:11:06 +0200, David Fraser wrote:

If you really need to get it working with 8.0.x libraries, you could try
converting the call to OCIInitialize() and OCIEnvInit() calls.
You'll need to replace OCITerminate with OCIHandleFree.
In my experience these are the two main changes between 8.0.x and 8.1
You might find some help from the cx_Oracle authors, but the oracle docs
are fairly good.

Thanks, David. I successfully replaced the OCIEnvCreate() call, but still
had problems with OCILobCreateTemporary(), OCILobFreeTemporary(),
OCIUserCallbackRegister(), OCIUserCallbackGet(), OCI_UCBTYPE_ENTRY,
OCI_UCBTYPE_EXIT and OCI_UCBTYPE_REPLACE. This amount of patchwork from my
inexperienced hands would be asking for trouble, even if I could get it
compiled.


Oh well, it was worth a try...
An 8i installation, as Aurelio suggested, is unfortunately not an option.
I'm now looking into ADO. I think it can fit the bill for my current
project, though I'd prefer to use the python DB API 2.0.


Aha! But you can... there are at least two DB API wrappers for ADO:
http://pyado.sourceforge.net/
http://adodbapi.sourceforge.net/

So your code remains DB-API compatible, and portable to other drivers,
but gets to use ADO and support any database supported by that...

David
Jul 18 '05 #6
> An 8i installation, as Aurelio suggested, is unfortunately not an option.

You still haven't told us why; are you running an 8.0.6 server
on that box? I reckon you could install a minimal more recent
oracle client, *not* put it on your global path, but simply stick
it at the beginning of your python script path *before* importing
cx_oracle.

Oracle instant client weights about 30Mb on windows:
http://otn.oracle.com/tech/oci/insta...antclient.html
(warning: this probably requires an OTN registration)

HTH,

Bernard.
Jul 18 '05 #7
On Tue, 08 Jun 2004 12:42:00 +0200, David Fraser wrote:
Aha! But you can... there are at least two DB API wrappers for ADO:
http://pyado.sourceforge.net/
http://adodbapi.sourceforge.net/


Yes! I imagined such a wrapper might exist and found adodbapi. It seems
quite satisfactory. I'll have a look at pyado too. Thanks again, David.

Rodrigo
Jul 18 '05 #8
On Tue, 08 Jun 2004 21:02:45 +0200, Bernard Delmée wrote:
An 8i installation, as Aurelio suggested, is unfortunately not an option.


You still haven't told us why; are you running an 8.0.6 server
on that box? I reckon you could install a minimal more recent
oracle client, *not* put it on your global path, but simply stick
it at the beginning of your python script path *before* importing
cx_oracle.

Oracle instant client weights about 30Mb on windows:
http://otn.oracle.com/tech/oci/insta...antclient.html
(warning: this probably requires an OTN registration)

HTH,

Bernard.


My only problem was licence. I wasn't aware of this Instant Client, but I'm
definitely giving it a try. Thanks Bernard.

Rodrigo

Jul 18 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10
by: GrayGeek | last post by:
After cx_Oracle and the related Oracle tools for Python 2.2.3 + Boa-constructor on Win2000, I added "import cx_Oracle" to the top of a test script. It gives me an error about being unable to find...
1
by: Greg Lindstrom | last post by:
>Shouldn't this be '/u01/app/oracle/product/9.2.0' ? Based on the following values, that's what I'd expect. I changed the ORCALE_HOME environment variable to the above suggested value and got a...
1
by: Maxim Kuleshov | last post by:
Hello! Trying to fetch long varchar2 column and get the following error: cx_Oracle.DatabaseError: column at array pos 0 fetched with error: 1406 i.e. string buffer is not much enough to...
5
by: Daniel | last post by:
Hello from Brazil :-) I'm trying to bring cx_Oracle alive on my Python 2.4.1 @ HP-UX 11 (suckz) and Oracle 10.1.0 64bits without success I've already tryied the suggestions from Bernard Delmée...
0
by: Steve | last post by:
I'm posting this message here, so that someone googling here will be able to find it. I was having problems installing cx_Oracle on Solaris. The build would fail with a message: > ld: fatal:...
6
4
by: infidel | last post by:
I have a stored procedure that has a single output parameter. Why do I have to pass it a string big enough to hold the value it is to receive? Why can't I pass an empty string or None? >>>...
7
by: Carl K | last post by:
I am trying to use this: http://python.net/crew/atuining/cx_Oracle/html/cx_Oracle.html it is a real module, right? sudo easy_install cx_Oracle did not easy_install cx_Oracle. ...
1
by: Lukas Ziegler | last post by:
Hi, I want to get an access to an oracle database. For that I found the module cx_oracle (http://www.python.net/crew/atuining/cx_Oracle/) and I have installed the version 'Windows Installer...
3
by: Benjamin Hell | last post by:
Hi! I have a problem with the cx_Oracle module (Oracle database access): On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) I can get query results consisting of strings...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
12
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
18
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.