Determining the Authentication Method Used by bcp and jdbc in SQL Server

95 Views Asked by At

I have been working on using the bcp utility to transfer data to and from SQL Server. I am currently interested in understanding how to determine the authentication method being used by bcp when connecting to SQL Server.

Specifically, I would like to distinguish whether bcp is using a service account or an interactive user account for authentication. I have read about the -T option for trusted connections (Windows Authentication), but I want to confirm if bcp is indeed using this mechanism.

Reason for this is I was able to connect with SQL Server on remote machine using this jdbc string

jdbc:jtds:sqlserver://server:1433;db;Domain=domain;useNTLMv2=true;Integrated Security=SSPI 

but am not able to do the same using

bcp.exe [db].[dbo].[table] in "file.txt" -S server,1433 -t "|**|" -e ..\logs\error.txt -w -T -k

I am getting

SQLState = 28000, NativeError = 18456 Error = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'domain\user'

If both will be using the same authentication means why I am getting this error only on bcp

I am getting this SQL exception while trying to connect SQL Server and I am not able to find the reason.

0

There are 0 best solutions below