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

SSL routine: tls_process_server_certificate:certificate verify failed - Adding support for TrustServerCertificate=yes #155

Open
locorecto opened this issue Oct 13, 2023 · 2 comments

Comments

@locorecto
Copy link

I am using bcpandas on SQL Server 2018 and using the same driver version. The db server I am connecting to server uses a self signed certificate. I am getting this error when I run to_sql:

SSL routine: tls_process_server_certificate:certificate verify failed: self signed certificate

We deal with this in pyodbc and sqlalchemy by adding TrustServerCertificate=yes in the connection string.

However, the same doesn't work in bcpandas. I tryied adding odbc_kwargs when I create the SqlCreds object like this

SqlCreds(server=server, database=db, username=uname, password=pwd, odbc_kwargs=dict(TrustServerCertificate='yes')

but it didn't work.

bcp documentation specifies you need to add the -u flag to Trust server certificate. But this is not available in bcpandas.

Any workarounds?

@locorecto
Copy link
Author

I was able to bypass certificate verification this by adding odbc_kwargs={'encrypt': 'no'} to my SqlCreds constructor. Again, only do this is you trust the server you a connecting to and the communication is behind a firewall.

@gordthompson
Copy link
Contributor

Duplicate of #126

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

2 participants