Skip to content

Commit 800b063

Browse files
Raise meaningful error when bequeath is attempted in thin mode (which is
unsupported).
1 parent 2b48b14 commit 800b063

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ Thin Mode Changes
3737
server certificate match the host name used to connect to the database.
3838
#) The text of error ``DPY-4022: invalid value for DRCP purity {purity}``
3939
changed to ``DPY-4022: invalid value for enumeration {name}: {value}``.
40+
#) Error ``DPY-3001: bequeath is only supported in python-oracledb thick
41+
mode`` is now raised when attempting to connect to the database without a
42+
connect string.
4043
#) Internal change: improve low-level encoding and decoding routines.
4144
#) Internal change: send buffer length for bind variables without unneeded
4245
adjustment.

src/oracledb/impl/thin/connection.pyx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,11 @@ cdef class ThinConnImpl(BaseThinConnImpl):
358358
Address address
359359
num_lists = len(description.active_children)
360360
num_attempts = description.retry_count + 1
361-
connect_string = _get_connect_data(description, self._connection_id, params)
361+
connect_string = _get_connect_data(description, self._connection_id,
362+
params)
363+
if connect_string is None:
364+
errors._raise_err(errors.ERR_FEATURE_NOT_SUPPORTED,
365+
feature="bequeath", driver_type="thick")
362366
for i in range(num_attempts):
363367
for j, address_list in enumerate(description.active_children):
364368
num_addresses = len(address_list.active_children)

tests/test_7300_unsupported_features_thin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import unittest
3030

31+
import oracledb
3132
import test_env
3233

3334

@@ -58,6 +59,14 @@ def test_7302(self):
5859
with self.assertRaisesFullCode("DPY-3001"):
5960
test_env.get_connection(supershardingkey=[17, 23])
6061

62+
def test_7303(self):
63+
"7303 - test connect() without a connect string (bequeath)"
64+
with self.assertRaisesFullCode("DPY-3001"):
65+
oracledb.connect(
66+
user=test_env.get_main_user(),
67+
password=test_env.get_main_password(),
68+
)
69+
6170

6271
if __name__ == "__main__":
6372
test_env.run_test_cases()

0 commit comments

Comments
 (0)