Skip to content

Commit 636be62

Browse files
Fixed bug when using external authentication with a TNS alias (#178).
1 parent 09b1b2f commit 636be62

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Thin Mode Changes
1616
Thick Mode Changes
1717
++++++++++++++++++
1818

19+
#) Fixed bug when using external authentication with a TNS alias
20+
(`issue 178 <https://github.com/oracle/python-oracledb/issues/178>`__).
21+
1922
Common Changes
2023
++++++++++++++
2124

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()

tests/test_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#------------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2023, 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

0 commit comments

Comments
 (0)