Skip to content

Commit 276306b

Browse files
committed
clear out other changes
1 parent 48c8722 commit 276306b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

sqlserver/changelog.d/20166.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allow for special characters in sqlserver pwds

sqlserver/datadog_checks/sqlserver/connection.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,16 @@ def _conn_string_odbc(self, db_key, conn_key=None, db_name=None):
638638
conn_str += 'UID={};'.format(username)
639639
self.log.debug("Connection string (before password) %s", conn_str)
640640
if password:
641-
conn_str += 'PWD={};'.format(password)
641+
escaped_password = password
642+
escaped_password = password.replace(
643+
'{', '{{'
644+
).replace(
645+
'}', '}}'
646+
).replace(
647+
'"', '""'
648+
)
649+
conn_str += 'PWD="{}";'.format(escaped_password)
650+
642651
return conn_str
643652

644653
def _conn_string_adodbapi(self, db_key, conn_key=None, db_name=None):

0 commit comments

Comments
 (0)