0
Hello!
I need help with the following problem:
I made a script in python to collect data from a DB2 table and generate a spreadsheet.
I’m in the testing phase, but the idea is that the script will run itself every day.
However, this week the table access password has expired and a new password has been generated. But this password contains the character ;
and because of it my script stopped working.
When the script arrives in this function:
def connect_db2(self, data_base, hostname, port, username, password):
try:
connection = ibm_db.connect(f"DATABASE={data_base};HOSTNAME={hostname};\
PORT={port}; PROTOCOL=TCPIP;UID={username};PWD={password};", "", "")
return connection
except Exception as e:
print(e)
the title error occurs:
SQLCODE=-30082r] SQL30082N Security processing failed with reason "24"("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001
I know it’s because of ;
because I tested the direct access in the table and it works, only it doesn’t work in the script.
At the time the problem occurred for the first time we changed the password and worked for the tests. Now, I’m about to put into production and again the problem occurs.
I do not want to have to ask the person responsible for access to verify the password before updating to the script does not stop working, since it is an automation.
I wonder if anyone knows any way the script/ function accept the ;
as part of the password.
force the escape of character: ;
– Claudio Lopes