1
- # Open Source Python/Oracle Utility - cx_Oracle
1
+ # Python cx_Oracle interface to Oracle Database
2
2
3
3
cx_Oracle is a Python extension module that enables access to Oracle Database.
4
4
It conforms to the [ Python database API 2.0 specification] [ 1 ] with a
@@ -11,61 +11,45 @@ cx_Oracle 6 has been tested with Python version 2.7, and with versions
11
11
client libraries. Oracle's standard client-server version
12
12
interoperability allows connection to both older and newer databases,
13
13
for example Oracle 12.2 client libraries can connect to Oracle
14
- Database 11.2 or later .
14
+ Database 11.2.
15
15
16
- ## Documentation
16
+ ## Getting Started
17
17
18
- See the [ cx_Oracle Documentation ] [ 2 ] and [ Release Notes ] [ 14 ] .
18
+ Install Python from [ python.org ] [ 4 ] .
19
19
20
- ## Help
20
+ Install cx_Oracle using [ Quick Start cx_Oracle Installation ] [ 6 ] .
21
21
22
- Issues and questions can be raised with the cx_Oracle community on
23
- [ GitHub ] [ 9 ] or on the [ mailing list ] [ 5 ] .
22
+ Download cx_Oracle [ samples ] [ 12 ] or create a script like the one
23
+ below .
24
24
25
- ## Installation
25
+ Locate your Oracle Database username and password, and the database
26
+ connection string. The connection string is commonly of the format
27
+ ` hostname/servicename ` , using the hostname where the database is
28
+ running, and the service name of the Oracle Database instance.
26
29
27
- See [ cx_Oracle Installation] [ 15 ] for detailed instructions.
30
+ Substitute your username, password and connection string in the code.
31
+ For downloaded examples, put these in [ ` SampleEnv.py ` ] [ 13 ] and
32
+ [ ` SampleEnv.sql ` ] [ 10 ] , and then follow [ ` sample/README ` ] [ 16 ] to create
33
+ the cx_Oracle sample schema. SQL scripts to create Oracle Database's
34
+ common sample schemas can be found at
35
+ [ github.com/oracle/db-sample-schemas] [ 17 ] .
28
36
29
- - The simplest way to install cx_Oracle 6 is with pip :
37
+ Run the Python script, for example :
30
38
31
39
```
32
- python -m pip install cx_Oracle --upgrade
40
+ python myscript.py
33
41
```
34
42
35
- If a binary wheel package is not available on [ PyPI] [ 6 ] for your platform, the
36
- source package will be used.
37
-
38
- Note that if you download a source zip file directly from GitHub
39
- that you will also need to download an [ ODPI-C] [ 10 ] source zip file
40
- and extract it inside the directory called "odpi".
41
-
42
- - After cx_Oracle is installed, Oracle client libraries must also be installed
43
- and configured. These can be from Oracle Instant Client, from a local Oracle
44
- Database, or from a full Oracle Client installation.
45
-
46
- If you need the libraries, download and unzip the [ Oracle Instant Client] [ 4 ]
47
- 'Basic' package for your platform and set PATH, LD_LIBRARY_PATH, or similar
48
- platform-specific library path loading environment. See
49
- the [ installation notes for ODPI-C] [ 13 ] for help.
50
-
51
- Versions 11.2, 12.1 and 12.2 of the Oracle Client libraries on Linux,
52
- Windows and macOS are supported. Users have also reported success
53
- with other platforms.
54
-
55
- If you require cx_Oracle 5.3, download a Windows installer from
56
- [ PyPI] [ 16 ] or use ` python -m pip install cx-oracle==5.3 ` to
57
- install from source.
58
-
59
- Very old versions of cx_Oracle can be found in the files section at
60
- [ SourceForce] [ 17 ] .
61
-
62
- ## Example
43
+ ### Sample cx_Oracle Script
63
44
64
45
``` python
46
+ # myscript.py
47
+
65
48
from __future__ import print_function
66
49
67
50
import cx_Oracle
68
51
52
+ # Connect as user "hr" with password "welcome" to the "oraclepdb" service running on this computer.
69
53
connection = cx_Oracle.connect(" hr" , " welcome" , " localhost/orclpdb" )
70
54
71
55
cursor = connection.cursor()
@@ -79,9 +63,32 @@ for fname, lname in cursor:
79
63
print (" Values:" , fname, lname)
80
64
```
81
65
82
- For more examples, please see the [ test suite] [ 11 ] and the
83
- [ samples] [ 12 ] . You can also look at the scripts in [ cx_OracleTools] [ 7 ] and
84
- the modules in [ cx_PyOracleLib] [ 8 ] .
66
+ ## Installation
67
+
68
+ See [ cx_Oracle Installation] [ 15 ] .
69
+
70
+ ## Examples
71
+
72
+ See the [ samples] [ 12 ] directory and the [ test suite] [ 11 ] . You can also
73
+ look at the scripts in [ cx_OracleTools] [ 7 ] and the modules in
74
+ [ cx_PyOracleLib] [ 8 ] .
75
+
76
+ ## Documentation
77
+
78
+ See the [ cx_Oracle Documentation] [ 2 ] .
79
+
80
+ ## Changes
81
+
82
+ See [ What's New] [ 18 ] and the [ Release Notes] [ 14 ] .
83
+
84
+ ## Tests
85
+
86
+ See the [ test suite] [ 11 ] .
87
+
88
+ ## Help
89
+
90
+ Issues and questions can be raised with the cx_Oracle community on
91
+ [ GitHub] [ 9 ] or on the [ mailing list] [ 5 ] .
85
92
86
93
## Features
87
94
@@ -169,17 +176,18 @@ for more information.
169
176
[ 1 ] : https://www.python.org/dev/peps/pep-0249
170
177
[ 2 ] : http://cx-oracle.readthedocs.io
171
178
[ 3 ] : https://github.com/oracle/python-cx_Oracle/blob/master/LICENSE.txt
172
- [ 4 ] : http ://www.oracle.com/technetwork/database/features/instant-client/index.html
179
+ [ 4 ] : https ://www.python.org/downloads/
173
180
[ 5 ] : http://lists.sourceforge.net/lists/listinfo/cx-oracle-users
174
- [ 6 ] : https ://pypi.python.org/pypi/cx_Oracle
181
+ [ 6 ] : http ://cx-oracle.readthedocs.io/en/latest/installation.html#quick-start-cx-oracle-installation
175
182
[ 7 ] : http://cx-oracletools.sourceforge.net
176
183
[ 8 ] : http://cx-pyoraclelib.sourceforge.net
177
184
[ 9 ] : https://github.com/oracle/python-cx_Oracle/issues
178
- [ 10 ] : https://oracle. github.io/odpi
185
+ [ 10 ] : https://github.com/oracle/python-cx_Oracle/blob/master/samples/sql/SampleEnv.sql
179
186
[ 11 ] : https://github.com/oracle/python-cx_Oracle/tree/master/test
180
187
[ 12 ] : https://github.com/oracle/python-cx_Oracle/tree/master/samples
181
- [ 13 ] : https://oracle. github.io/odpi/doc/installation.html
188
+ [ 13 ] : https://github.com/oracle/python-cx_Oracle/tree/master/samples/SampleEnv.py
182
189
[ 14 ] : http://cx-oracle.readthedocs.io/en/latest/releasenotes.html
183
190
[ 15 ] : http://cx-oracle.readthedocs.io/en/latest/installation.html
184
- [ 16 ] : https://pypi.python.org/pypi/cx_Oracle/5.3
185
- [ 17 ] : https://sourceforge.net/projects/cx-oracle/files/
191
+ [ 16 ] : https://github.com/oracle/python-cx_Oracle/tree/master/samples/README.md
192
+ [ 17 ] : https://github.com/oracle/db-sample-schemas
193
+ [ 18 ] : http://cx-oracle.readthedocs.io/en/latest/whatsnew.html
0 commit comments