Skip to content

Commit 82d17ac

Browse files
Fixed bug when using external authentication with a TNS alias (#178).
1 parent e5bcbe2 commit 82d17ac

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Thin Mode Changes
2222
Thick Mode Changes
2323
++++++++++++++++++
2424

25+
#) Fixed bug when using external authentication with a TNS alias
26+
(`issue 178 <https://github.com/oracle/python-oracledb/issues/178>`__).
27+
2528
Common Changes
2629
++++++++++++++
2730

src/oracledb/impl/base/connect_params.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ cdef class ConnectParamsImpl:
572572
if pos >= 0:
573573
user = credentials[:pos] or None
574574
password = credentials[pos + 1:] or None
575+
elif connect_string is None:
576+
connect_string = dsn or None
577+
user = password = None
575578
else:
576579
user = credentials or None
577580
password = None

tests/test_1100_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_1104_autocommit(self):
138138

139139
def test_1105_bad_connect_string(self):
140140
"1105 - connection to database with bad connect string"
141-
self.assertRaisesRegex(oracledb.DatabaseError, "^DPY-4001:|ORA-12547:",
141+
self.assertRaisesRegex(oracledb.DatabaseError, "^DPY-4000:|ORA-12154:",
142142
oracledb.connect, test_env.get_main_user())
143143
self.assertRaisesRegex(oracledb.DatabaseError, "^DPY-4000:|^DPY-4001:",
144144
oracledb.connect, test_env.get_main_user() + \

tests/test_4500_connect_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,5 +619,14 @@ def test_4560_dsn_with_empty_credentials(self):
619619
self.assertEqual(password, None)
620620
self.assertEqual(dsn, None)
621621

622+
def test_4561_dsn_with_no_credentials(self):
623+
"4561 - test parsing a DSN with no credentials"
624+
dsn_in = "my_alias_4561"
625+
params = oracledb.ConnectParams()
626+
user, password, dsn_out = params.parse_dsn_with_credentials(dsn_in)
627+
self.assertEqual(user, None)
628+
self.assertEqual(password, None)
629+
self.assertEqual(dsn_out, dsn_in)
630+
622631
if __name__ == "__main__":
623632
test_env.run_test_cases()

0 commit comments

Comments
 (0)