|
1 | 1 | # Python cx_Oracle |
2 | 2 |
|
3 | | -# News |
| 3 | +**cx_Oracle was obsoleted by |
| 4 | +[python-oracledb](https://oracle.github.io/python-oracledb/) in 2022.** |
4 | 5 |
|
5 | | -**cx_Oracle has a major new release under a new name and homepage |
6 | | -[python-oracledb](https://oracle.github.io/python-oracledb/).** |
| 6 | +Python-oracledb uses the same Python DB API as cx_Oracle, and has many new |
| 7 | +features. |
7 | 8 |
|
8 | | -**The source code has moved to |
9 | | -[github.com/oracle/python-oracledb](https://github.com/oracle/python-oracledb).** |
| 9 | +Install with: |
10 | 10 |
|
11 | | -New projects should install python-oracledb instead of cx_Oracle. Critical |
12 | | -patches and binary packages for new Python releases may continue to be made in |
13 | | -the cx_Oracle namespace for a limited time, subject to demand. |
| 11 | +``` |
| 12 | +python -m pip install oracledb |
| 13 | +``` |
14 | 14 |
|
15 | | -# About |
| 15 | +Usage is like: |
16 | 16 |
|
17 | | -cx_Oracle is a Python extension module that enables access to Oracle |
18 | | -Database. It conforms to the [Python database API 2.0 |
19 | | -specification][1] with a considerable number of additions and a couple |
20 | | -of exclusions. See the |
21 | | -[homepage](https://oracle.github.io/python-cx_Oracle/index.html) for a |
22 | | -feature list. |
| 17 | +``` |
| 18 | +import getpass |
| 19 | +import oracledb |
23 | 20 |
|
24 | | -cx_Oracle 8.3 was tested with Python versions 3.6 through 3.10. You can |
25 | | -use cx_Oracle with Oracle 11.2, 12c, 18c, 19c and 21c client libraries. |
26 | | -Oracle's standard client-server version interoperability allows connection to |
27 | | -both older and newer databases. For example Oracle 19c client libraries can |
28 | | -connect to Oracle Database 11.2. Older versions of cx_Oracle may work with |
29 | | -older versions of Python. |
| 21 | +un = 'scott' |
| 22 | +cs = 'localhost/orclpdb1' |
| 23 | +pw = getpass.getpass(f'Enter password for {un}@{cs}: ') |
30 | 24 |
|
31 | | -## Installation |
| 25 | +with oracledb.connect(user=un, password=pw, dsn=cs) as connection: |
| 26 | + with connection.cursor() as cursor: |
| 27 | + sql = 'select systimestamp from dual' |
| 28 | + for r in cursor.execute(sql): |
| 29 | + print(r) |
| 30 | +``` |
32 | 31 |
|
33 | | -See [cx_Oracle Installation][15]. |
34 | | - |
35 | | -## Documentation |
36 | | - |
37 | | -See the [cx_Oracle Documentation][2] and [Release Notes][14]. |
38 | | - |
39 | | -## Samples |
40 | | - |
41 | | -See the [/samples][12] directory and the [tutorial][6]. You can also |
42 | | -look at the scripts in [cx_OracleTools][7] and the modules in |
43 | | -[cx_PyOracleLib][8]. |
44 | | - |
45 | | -## Help |
46 | | - |
47 | | -Issues and questions can be raised with the cx_Oracle community on |
48 | | -[GitHub][9] or on the [mailing list][5]. |
49 | | - |
50 | | -## Tests |
51 | | - |
52 | | -See [/test][11]. |
53 | | - |
54 | | -## Contributing |
55 | | - |
56 | | -The cx_Oracle driver was renamed to python-oracledb in May 2022. It has a new |
57 | | -repository at https://github.com/oracle/python-oracledb |
58 | | - |
59 | | -Please submit your contributions to the python-oracledb repository. |
60 | | - |
61 | | -No further releases under the cx_Oracle namespace are planned. |
62 | | - |
63 | | -## Security |
64 | | - |
65 | | -Please consult the [security guide](./SECURITY.md) for our responsible security |
66 | | -vulnerability disclosure process. |
67 | | - |
68 | | -## License |
69 | | - |
70 | | -cx_Oracle is licensed under a BSD license which you can find [here][3]. |
71 | | - |
72 | | -[1]: https://peps.python.org/pep-0249/ |
73 | | -[2]: https://cx-oracle.readthedocs.io |
74 | | -[3]: https://github.com/oracle/python-cx_Oracle/blob/main/LICENSE.txt |
75 | | -[5]: https://sourceforge.net/projects/cx-oracle/lists/cx-oracle-users |
76 | | -[6]: https://github.com/oracle/python-cx_Oracle/tree/main/samples/tutorial |
77 | | -[7]: http://cx-oracletools.sourceforge.net |
78 | | -[8]: http://cx-pyoraclelib.sourceforge.net |
79 | | -[9]: https://github.com/oracle/python-cx_Oracle/issues |
80 | | -[11]: https://github.com/oracle/python-cx_Oracle/tree/main/test |
81 | | -[12]: https://github.com/oracle/python-cx_Oracle/tree/main/samples |
82 | | -[14]: https://cx-oracle.readthedocs.io/en/latest/release_notes.html |
83 | | -[15]: https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html |
| 32 | +The source code for python-oracledb is at |
| 33 | +[github.com/oracle/python-oracledb](https://github.com/oracle/python-oracledb). |
0 commit comments