473,545 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ 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\g cc.exe -mno-cygwin -mdll -O -Wall -Id:\orant\oci80 \include
:-Id:\orant\rdbms 80\demo -ID:\Python23\in clude -ID:\Python23\PC -c
:cx_Oracle.c -o build\temp.win3 2-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_Ne w':
: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, "OCIEnvCrea te 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 6254
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\g cc.exe -mno-cygwin -mdll -O -Wall -Id:\orant\oci80 \include
:-Id:\orant\rdbms 80\demo -ID:\Python23\in clude -ID:\Python23\PC -c
:cx_Oracle.c -o build\temp.win3 2-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_Ne w':
: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, "OCIEnvCrea te 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, "OCIEnvCrea te 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
(tryimportOCIPr oc and importedOCIProc and importOCIProc are macros that
do dynamic function resolving, you should get the general idea)

tryimportOCIPro c(OCIEnvCreate, sword, (OCIEnv **envp, ub4 mode, dvoid
*ctxp,
dvoid *(*malocfp)(dvo id *ctxp, size_t size),
dvoid *(*ralocfp)(dvo id *ctxp, dvoid *memptr, size_t newsize),
void (*mfreefp)(dvoi d *ctxp, dvoid *memptr),
size_t xtramem_sz, dvoid **usrmempp));

if (!importedOCIPr oc(OCIEnvCreate ))
{
importOCIProc(O CIInitialize, sword, (ub4 mode, CONST dvoid *ctxp,
CONST dvoid *(*malocfp)(dvo id *ctxp, size_t size),
CONST dvoid *(*ralocfp)(dvo id *ctxp, dvoid *memptr,size_t newsize),
CONST void (*mfreefp)(dvoi d *ctxp,dvoid *memptr)));
importOCIProc(O CIEnvInit, sword, (OCIEnv **envhpp, ub4 mode,
size_t xtramemsz, dvoid **usrmempp));

if (envhp == 0)
{
OCIInitialize(O CI_THREADED, 0, 0, 0, 0);
OCIEnvInit(&env hp, OCI_DEFAULT, 100, &testmem);
}
// AfxMessageBox(" Using OCI 8.0",MB_OK);
}
else
{
if (envhp == 0)
OCIEnvCreate(&e nvhp, 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 OCILobCreateTem porary(), OCILobFreeTempo rary(),
OCIUserCallback Register(), OCIUserCallback Get(), OCI_UCBTYPE_ENT RY,
OCI_UCBTYPE_EXI T and OCI_UCBTYPE_REP LACE. 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 OCILobCreateTem porary(), OCILobFreeTempo rary(),
OCIUserCallback Register(), OCIUserCallback Get(), OCI_UCBTYPE_ENT RY,
OCI_UCBTYPE_EXI T and OCI_UCBTYPE_REP LACE. 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

10
8959
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 the OCISetDefault entry point in 'oci.dll'. Google says nothing about this error, and neither does the cx_Oracle author. Anyone have a solution...
1
8490
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 new error!! That's progress, right? I'm now told: cx_Oracle.DatabaseError: ORA-12154: TNS:could not resolve service name /usr/bin/sh:...
1
4405
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 fetch the string. # fragment of code... myCon = cx_Oracle.connect(user, psw, dsn)
5
3825
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 and Martin v. Löwis (topic "Python 2.3b1 + cx_oracle 3.0 on HP-UX"), but it didn't work, even when I recompiled Python with the "-lc -lpthread"...
0
2621
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: file /apps/oracle/prod/9.2/lib/libclntsh.so: wrong ELF class: ELFCLASS64 I found the solution on Grig Gheorghiu's blog. Grig had similar...
4
13341
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? >>> import cx_Oracle as oracle >>> connection = oracle.connect('usr/pwd@tns') >>> cursor = connection.cursor() >>> network_name, =...
7
14691
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. http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue. I got the source from...
1
2586
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 (Oracle 10g, Python 2.5)'. Now I tried to run the script in the readme file: -------------------------------------------------------------------...
3
4832
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 including non-ASCII characters, e.g. the code example below outputs "é 0xe9" (which is the correct ISO-8859-1 hex code for "é"). On a newer installation...
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7943
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7786
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
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 we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.