soda-core icon indicating copy to clipboard operation
soda-core copied to clipboard

Error connection with SQL and param string Trusted_Connection=True

Open rodrigomartinez1302 opened this issue 1 year ago • 5 comments

Hi everyone, I found an issue when building the string connection with sql on the module: sqlserver_data_source.py

When the connection is trusted, you dont need user and pass, so the solution could be: (the last two lines were added)

self.connection = pyodbc.connect( ("Trusted_Connection=YES;" if self.trusted_connection else "") + ("TrustServerCertificate=YES;" if self.trust_server_certificate else "") + ("Encrypt=YES;" if self.encrypt else "") + "DRIVER={" + self.driver + "};SERVER=" + self.host + "," + str(self.port) + ";DATABASE=" + self.database + (";UID=" + self.username if not self.trusted_connection else "") + (";PWD=" + self.password if not self.trusted_connection else "") )

Many thanks guys for the job done, i am starting to use it and i like it :)

rodrigomartinez1302 avatar Sep 11 '23 14:09 rodrigomartinez1302

SAS-2143

tools-soda avatar Sep 11 '23 15:09 tools-soda

Thank you for the report @rodrigomartinez1302 ! Would you like to open a PR with the fix? I'll be happy to merge it ASAP.

vijaykiran avatar Sep 11 '23 15:09 vijaykiran

Hi, Is this issue fixed ?

tinkujv avatar Oct 28 '23 20:10 tinkujv

Not yet, would you be able to open a PR for this @rodrigomartinez1302 ?

m1n0 avatar Oct 30 '23 20:10 m1n0