Skip to content

Commit 0ad6125

Browse files
All Oracle errors that result in the connection no longer being usable
will be raised as "DPY-4011: the database or network closed the connection", with the underlying reason being included in the error message.
1 parent fe435a7 commit 0ad6125

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ Common Changes
8989
#) Fixed bug where some :ref:`DbObject <dbobjecttype>` attributes for database
9090
objects defined using ANSI names (including FLOAT and REAL) may have shown
9191
as integers.
92+
#) All Oracle errors that result in the connection no longer being usable will
93+
be raised as ``DPY-4011: the database or network closed the connection``
94+
with the underlying reason being included in the error message.
9295
#) Error ``DPY-2056: registered handler for protocol "{protocol}" failed for
9396
arg "{arg}"`` is now raised when an exception occurs when calling the
9497
registered handler for a protocol.

src/oracledb/errors.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2024, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2025, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -373,11 +373,33 @@ def _raise_not_supported(feature: str) -> None:
373373

374374
# Oracle error number cross reference
375375
ERR_ORACLE_ERROR_XREF = {
376+
22: ERR_CONNECTION_CLOSED,
376377
28: ERR_CONNECTION_CLOSED,
378+
31: ERR_CONNECTION_CLOSED,
379+
45: ERR_CONNECTION_CLOSED,
380+
378: ERR_CONNECTION_CLOSED,
377381
600: ERR_CONNECTION_CLOSED,
382+
602: ERR_CONNECTION_CLOSED,
383+
603: ERR_CONNECTION_CLOSED,
384+
609: ERR_CONNECTION_CLOSED,
378385
1005: ERR_NO_CREDENTIALS,
386+
1012: ERR_CONNECTION_CLOSED,
387+
1041: ERR_CONNECTION_CLOSED,
388+
1043: ERR_CONNECTION_CLOSED,
389+
1089: ERR_CONNECTION_CLOSED,
390+
1092: ERR_CONNECTION_CLOSED,
379391
1740: ERR_MISSING_ENDING_DOUBLE_QUOTE,
380392
1756: ERR_MISSING_ENDING_SINGLE_QUOTE,
393+
2396: ERR_CONNECTION_CLOSED,
394+
3113: ERR_CONNECTION_CLOSED,
395+
3114: ERR_CONNECTION_CLOSED,
396+
3122: ERR_CONNECTION_CLOSED,
397+
3135: ERR_CONNECTION_CLOSED,
398+
12153: ERR_CONNECTION_CLOSED,
399+
12537: ERR_CONNECTION_CLOSED,
400+
12547: ERR_CONNECTION_CLOSED,
401+
12570: ERR_CONNECTION_CLOSED,
402+
12583: ERR_CONNECTION_CLOSED,
381403
22165: (
382404
ERR_INVALID_COLL_INDEX_SET,
383405
r"index \[(?P<index>\d+)\] must be in the range of "
@@ -391,7 +413,10 @@ def _raise_not_supported(feature: str) -> None:
391413
24496: ERR_POOL_NO_CONNECTION_AVAILABLE,
392414
24338: ERR_INVALID_REF_CURSOR,
393415
24344: WRN_COMPILATION_ERROR,
416+
27146: ERR_CONNECTION_CLOSED,
417+
28511: ERR_CONNECTION_CLOSED,
394418
38902: ERR_TOO_MANY_BATCH_ERRORS,
419+
56600: ERR_CONNECTION_CLOSED,
395420
}
396421

397422
# ODPI-C error number cross reference

0 commit comments

Comments
 (0)