Search code examples
sql-serverbcpbulk-load

Microsoft SQL Server error certificate verify failed:self-signed certificate" when using bcp utility


On Linux server I would like to bulk load data into a database table. I tried this command:

bcp dbo.ProjectStaging_AdIMI out test.txt -c -T -S localhost

but I get an error:

SQLState = 08001, NativeError = -1
Error = [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider:
[error:0A000086:SSL routines::certificate verify failed:self-signed certificate]

SQLState = 08001, NativeError = -1
Error = [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection.
For solutions related to encryption errors, see https://go.microsoft.com/fwlink/?linkid=2226722

This is test computer and I don't need any encryption. I know for sqlcmd tool I need to use -No switch to disable this encryption, but I don't know which switch to use using bcp command.


Solution

  • Specify the -u BCP argument to trust the certificate with BCP version 18 and later:

    bcp dbo.ProjectStaging_AdIMI out test.txt -c -T -S localhost -u