Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connection with SQL and param string Trusted_Connection=True #1934

Closed
rodrigomartinez1302 opened this issue Sep 11, 2023 · 5 comments
Closed

Comments

@rodrigomartinez1302
Copy link

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

@tools-soda
Copy link

SAS-2143

@vijaykiran
Copy link
Contributor

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

@tinkujv
Copy link

tinkujv commented Oct 28, 2023

Hi, Is this issue fixed ?

@m1n0
Copy link
Contributor

m1n0 commented Oct 30, 2023

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

@sdebruyn
Copy link
Contributor

Fixed this in #2160

@m1n0 m1n0 closed this as completed Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants