I have the following simple code for python (version 3.6.1 x64 Windows):
# -*- coding: utf-8 -*-
import cx_Oracle
import os
os.environ["NLS_LANG"] = "RUSSIAN_RUSSIA.AL32UTF8"
conn = cx_Oracle.connect("user/pass@//host:1521/dbname")
cur = conn.cursor()
print(cx_Oracle.__version__)
print(conn.encoding)
print(conn.nencoding)
cur.execute("select 'Значение' from dual")
res = cur.fetchone()
cur.close()
conn.close()
print(res)
With cx_Oracle version 5.3 it works as expected and gives the following output:
5.3
UTF-8
UTF-8
('Значение',)
But with the 6.02b version it becomes broken.
6.0b2
ASCII
ASCII
Traceback (most recent call last):
File "C:/Users/SBT-Chernopyatov-AS/PycharmProjects/CUP_Fetcher/ptest_602.py", line 15, in <module>
cur.execute("select 'Значение' from dual")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 8-15: ordinal not in range(128)
Traceback (most recent call last):
File "C:/Users/SBT-Chernopyatov-AS/PycharmProjects/CUP_Fetcher/ptest_602.py", line 7, in <module>
conn = cx_Oracle.connect("user/pass@//host:1521/dbname", encoding='UTF-8')
cx_Oracle.DatabaseError: DPI-1005: unable to acquire Oracle environment handle
So, seems there is no way to work with the unicode strings right now.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4