-2

I am trying to connect to a SQL server using Windows authentication. I am doing it through node js on Visual Studio.

The SQL server is on my machine itself. It had worked fine for the connection string

var config = {
server: '10.2.9.208',                       
database: 'DFMProAnalyticsCopy',                            
user: 'sa',                                     
password: 'admin123#',
port: 1433                                      //default port number
};

But this was only for SQL authentication.

Now for Windows aunthentication, I have this connection string

var config = 
"Driver ={SQL Server};Server = 10.2.9.208;Database=DFMProAnalyticsCopy;Trusted_Connection=True;";

This gives me error

Unknown driver SQL Server!

and this connection string

var config = 
"Server = 10.2.9.208;Database=DFMProAnalyticsCopy;Trusted_Connection=True;";

gives error

Login failed for user ''

It is trying to attempt SQL authentication when I want Windows authentication. I have Mixed mode authentication ON.

I read at many places but am still unclear about it.

"Login failed for user ''" when trying to use Windows Authentication

Please help me.

EDIT 1:

I cannot use the configuration string as in SQL Server connection with jQuery and node js because mine is centralised and anyone could be using it, so I need to use Trusted_connection=true or Integrated security = SSPI. I dont have windows login credentials of people using the system.

2
  • So the first question is does your app pool worker service account have access to the SQL instance? Is it even a domain service account or still a local account? Commented Jun 8, 2016 at 7:15
  • Hi, I checked it. I have access to SQL instance & is a domain server account. I have edited the question Commented Jun 9, 2016 at 5:53

1 Answer 1

1

This worked for me. I had to provide an UID and password in the connection string, else it considered a null string for UID

var config = "Server={IPV4 of server};Database=dbname;Uid=domain\\username;Pwd=pwd";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.