Questions tagged [cx-oracle]

cx_Oracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification.

This tag is used for questions about or involving the Python extension module cx_Oracle, which enables querying and updating of the Oracle DBMS. cx_Oracle conforms to the Python Database API Specification and includes a number of additions to this specification.

Questions tagged should also be tagged and possibly .

If the question is related to a specific version of Python or Oracle this tag should also be included. The current version of cx_Oracle is available for , and and various Python versions between 2.7 and 3.6 .

Useful links:

1621 questions
55
votes
3 answers

cx_Oracle: How do I iterate over a result set?

There are several ways to iterate over a result set. What are the tradeoff of each?
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
50
votes
12 answers

cx_Oracle error. DPI-1047: Cannot locate a 64-bit Oracle Client library

I installed the library and when trying to access SQL in jupyter notebook with my credentials the following error appears: DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found".…
Rexilife
  • 565
  • 1
  • 4
  • 7
40
votes
10 answers

How can I access Oracle from Python?

How can I access Oracle from Python? I have downloaded a cx_Oracle msi installer, but Python can't import the library. I get the following error: import cx_Oracle Traceback (most recent call last): File "", line 1, in
user425194
  • 503
  • 2
  • 5
  • 8
40
votes
8 answers

cx_Oracle doesn't connect when using SID instead of service name on connection string

I have a connection string that looks like this con_str = "myuser/mypass@oracle.sub.example.com:1521/ora1" Where ora1 is the SID of my database. Using this information in SQL Developer works fine, meaning that I can connect and query without…
Andy
  • 49,085
  • 60
  • 166
  • 233
34
votes
6 answers

How to fix: cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library - Python

I am establishing a connection to oracle 11g which is in a remote server using cx_oracle 7 with python 3.6.7. my OS in Ubuntu 18.04 I have installed oracle instant client library with libclntsh.so but I am not getting the expected output. here is…
Ian Nato
  • 963
  • 1
  • 14
  • 25
32
votes
2 answers

cx_Oracle and Exception Handling - Good practices?

I'm trying to use cx_Oracle to connect to an Oracle instance and execute some DDL statements: db = None try: db = cx_Oracle.connect('username', 'password', 'hostname:port/SERVICENAME') #print(db.version) except cx_Oracle.DatabaseError as e: …
victorhooi
  • 16,775
  • 22
  • 90
  • 113
29
votes
1 answer

CX_Oracle - import data from Oracle to Pandas dataframe

Hy, I'm new in python and I want import some data from a Oracle Database to python (pandas dataframe) using this simple query SELECT* FROM TRANSACTION WHERE DIA_DAT >=to_date('15.02.28 00:00:00', 'YY.MM.DD…
Kardu
  • 865
  • 3
  • 13
  • 24
29
votes
6 answers

cx_Oracle & Connecting to Oracle DB Remotely

How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password? Whenever I try to specify and IP address, it seems to be taking it…
dshadower
28
votes
5 answers

Issue building cx_Oracle - libclntsh.so.11.1 => not found

I'm trying to build cx_Oracle for a Python 2.7.2 and Oracle 11g installation but the built cx_Oracle.so cannot find libclntsh.so.11.1 so importing cx_Oracle in Python fails. /mypath/cx_Oracle-5.1.1/build/lib.linux-x86_64-2.7-11g]$ ldd cx_Oracle.so …
Alex
  • 373
  • 1
  • 3
  • 9
24
votes
2 answers

Python cx_Oracle bind variables

I am a Python newbie, I am having troubles in the use of bind variables. If I execute the code below everything works fine. bind= {"var" : "ciao"} sql = "select * from sometable where somefield =…
Giovanni De Ciantis
  • 357
  • 1
  • 2
  • 11
24
votes
3 answers

Why the need to commit explicitly when doing an UPDATE?

Here's my code: import cx_Oracle conn = cx_Oracle.connect(usr, pwd, url) cursor = conn.cursor() cursor.execute("UPDATE SO SET STATUS='PE' WHERE ID='100'") conn.commit() If I remove the conn.commit(), the table isn't updated. But for select…
tshepang
  • 12,111
  • 21
  • 91
  • 136
23
votes
5 answers

How do I read cx_Oracle.LOB data in Python?

I have this code: dsn = cx_Oracle.makedsn(hostname, port, sid) orcl = cx_Oracle.connect(username + '/' + password + '@' + dsn) curs = orcl.cursor() sql = "select TEMPLATE from my_table where id ='6'" curs.execute(sql) rows =…
Di Zou
  • 4,469
  • 13
  • 59
  • 88
23
votes
3 answers

Help installing cx_Oracle

I'm trying to install the cx_Oracle for Python 2.6, but it is failing. I don't know enough about C or MS Vis. Studio's compiler to even approach fixing it myself. This is what is output on the command…
cwallenpoole
  • 79,954
  • 26
  • 128
  • 166
20
votes
4 answers

Better ways to print out column names when using cx_Oracle

Found an example using cx_Oracle, this example shows all the information of Cursor.description. import cx_Oracle from pprint import pprint connection = cx_Oracle.Connection("%s/%s@%s" % (dbuser, dbpasswd, oracle_sid)) cursor =…
philipjkim
  • 3,999
  • 7
  • 35
  • 48
20
votes
4 answers

cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files

I need install cx_Oracle for Python 2.5 on Linux (Linux 2.6.18-371.1.2.el5 i686). I have installed Oracle client 10.2.0.4. I have tried following: 1. Download cx_Oracle tar.gz from http://sourceforge.net/projects/cx-oracle/files/. I don't know…
khris
  • 4,809
  • 21
  • 64
  • 94
1
2 3
99 100