You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bulkcopy requires explicit TrustServerCetificate=yes with Encrypt=No #459
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
changed the title [-]Bulkcopy requires explicit TrustServerCetificate=True with Encrypt=No[/-][+]Bulkcopy requires explicit TrustServerCetificate=yes with Encrypt=No[/+]on Feb 28, 2026
# Why are you running Microsoft SQL Server on port 1434# by default, Microsoft SQL Server runs on port 1433#conn = mssql_python.connect("Server=192.168.105.105,1434;Database=aw;Uid=aa;Pwd=[mypwd];Encrypt=No;")conn=mssql_python.connect("Server=192.168.105.105,1433;Database=aw;Uid=aa;Pwd=[mypwd];Encrypt=No;")
cur=conn.cursor()
cur.execute('create table #x (i int);')
cur.execute('insert into ##x (i) values (-1); ')
cur.execute('drop table #x;')
As an aside, why are you passing along port 1434?
By default, SQL Server runs on port 1433.
Unfortunately, the error that I received is:-
[Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted.
Relief came in specifying "encrypt=no".
No need for TrustServerCertificate=yes.
You may want to review the following, as well:-
SQL Server Version
SQL Server SSL Configuration ( is SSL set to be required )
2a) if SSL is required, specifying "encrypt=no" will not skip the requirement for SSL.
Thanks for reporting the issue.
I am not sure how to re-create it .
In as much as "cur.execute('create table #x (i int);')" works, you should not fail at "cur.bulkcopy('#x', ((r,) for r in range(100)))".
Failing at bulkcopy will mean the bulkcopy code is attempting a new database connection.
Activity
[-]Bulkcopy requires explicit TrustServerCetificate=True with Encrypt=No[/-][+]Bulkcopy requires explicit TrustServerCetificate=yes with Encrypt=No[/+]github-actions commentedon Feb 28, 2026
Hi Saurabh Singh (@saurabh500), thank you for opening this issue!
Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.
If you have additional information to share, please feel free to update the issue.
Thank you for your patience!
DanielAdeniji commentedon Mar 9, 2026
Saurabh Singh (@saurabh500),
Fam, this has nothing to do with bulk-copy.
As an aside, why are you passing along port 1434?
By default, SQL Server runs on port 1433.
Unfortunately, the error that I received is:-
Relief came in specifying "encrypt=no".
No need for TrustServerCertificate=yes.
You may want to review the following, as well:-
SQL Server Version
SQL Server SSL Configuration ( is SSL set to be required )
2a) if SSL is required, specifying "encrypt=no" will not skip the requirement for SSL.
Thanks for reporting the issue.
I am not sure how to re-create it .
In as much as "cur.execute('create table #x (i int);')" works, you should not fail at "cur.bulkcopy('#x', ((r,) for r in range(100)))".
Failing at bulkcopy will mean the bulkcopy code is attempting a new database connection.
I will suggest you try
cursor.execute("select @ServerName")
in place of the bulkcopy.
Nice question.
And, thank you kindly.