A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/oracle/python-oracledb/issues/133 below:

Multibyte string in query results in ORA-03120/ORA-03146 DatabaseError · Issue #133 · oracle/python-oracledb · GitHub

Hi,

  1. What versions are you using?

DB: Oracle Database 12c EE Extreme Perf Release 12.1.0.2.0 - 64bit Production
Client: oracledb.version: 1.2.2

  1. Is it an error or a hang or a crash?

DatabaseError

  1. What error(s) or behavior you are seeing?

We are currently facing an issue where certain query strings that use to work with cx_Oracle are throwing either ORA-03120 or ORA-03146 errors. The same query using DBeaver client works so the issue is likely with oracledb.

Our code goes like:

conn = oracledb.connect(
user=user,
password=pw,
host=host,
port=port,
service_name=service_name
)

sql = """
    SELECT *
    FROM TABLE
    WHERE FIELD = 'カタカナ'
"""

with conn.cursor() as cur:
    cur.execute(sql)
    rows = cur.fetchall()

Which results in DatabaseError: ORA-03146: Invalid buffer length for TTC field

If we added a limit on the results, a different DatabaseError is thrown

sql = """
    SELECT *
    FROM TABLE
    WHERE FIELD = 'カタカナ'
    FETCH FIRST 10 ROWS ONLY
"""

This will result in ORA-03120: two-task conversion routine: integer overflow

After trial and error, we found that using bind variable helps to get us past this issue:

sql = """
    SELECT *
    FROM TABLE
    WHERE FIELD = :katakana
"""

with conn.cursor() as cur:
    cur.execute(sql, katakana='カタカナ')
    rows = cur.fetchall()
  1. Does your application call init_oracle_client()?

No, we use the thin client. But the same queries work with cx_Oracle and DBeaver client.

  1. Include a runnable Python script that shows the problem.

See above.

Thanks!


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