Skip to content

Bulkcopy requires explicit TrustServerCetificate=yes with Encrypt=No #459

@saurabh500

Description

@saurabh500

Describe the bug

conn = mssql_python.connect("Server=192.168.105.105,1434;Database=aw;Uid=aa;Pwd=[mypwd];Encrypt=No;")
cur = conn.cursor()
cur.execute('create table #x (i int);')
cur.bulkcopy('#x', ((r,) for r in range(100)))

The above should work on a local sql server say in Docker.
But it throws an error

RuntimeError: Failed to connect to SQL Server: TLS handshake failed while connecting to '192.168.105.105': error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1889: (self-signed certificate). Certificate SANs: (unavailable - handshake failed before certificate could be retrieved)

Work around

Use TrustServerCertificate=yes in the connection string with Encrypt=No

Reported here #414 (reply in thread)

Metadata

Metadata

Assignees

Labels

triage neededFor new issues, not triaged yet.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions