I have not yet been successful at bulk importing CSV files into Azure SQL Server using the BCP Utility. I continue to receive the error The certificate chain was issued by an authority that is not trusted
.
Here is my Script/Code:
bcp DestinationDatabase.Table IN `
"C:\Data\CSVDataNeedingImported.csv" `
-c -G `
-U myAzureUserName@domain.com `
-P $pass `
-S AzureServerName
I have little experience setting up certificates. I am needing to know where or what I should do next. I'm hoping someone might be able to point me in the right direction.
Full Error:
SQLState = 08001, NativeError = -2146893019
Error = [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted
.
SQLState = 08001, NativeError = -2146893019
Error = [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection
Screenshot of PowerShell ISE:
When I run the following
bcp DimDate2 in C:\Users\....\mycsvfile.csv -S knewserver -d Mysqldb -U Kavya -P sjjhs@123
Error:
SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
SQLState = 08001, NativeError = 53
Error = [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or n
ot accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
Destination table must contain similar table columns as the copying data
CREATE TABLE destb
(
name char NOT NULL,
rno TINYINT NOT NULL,
)
;
Make sure the server has network access enabled
I could get past the error by using -T which
Following command worked for me
bcp destb in C:\Users\...\mycsvfile.txt -S knewserver.database.windows.net -d Mysqldb -U Kavya -P Sgfhgr@123 -q -c -t ","
Refer Load data from CSV file into a database (bcp) - Azure SQL | Microsoft Learn