DATA Step, Macro, Functions and more

Connection String to SQL Server Not Working

Accepted Solution Solved
Reply
Super Contributor
Posts: 326
Accepted Solution

Connection String to SQL Server Not Working

I'm having trouble connecting to a SQL Server 2016 DB when the string password is encoded.

 

This works.

libname test2 odbc noprompt="server=SRV;Driver=SQL Server;uid=sa;pwd=mypwd;database=DB";

 

But this doesn't work.

libname test2 odbc noprompt="server=SRV;Driver=SQL Server;uid=sa;pwd='{SASENC}12345F';database=DB";

 

Appreciate any help. Thank you very much!


Accepted Solutions
Solution
‎07-14-2017 11:03 AM
Super User
Posts: 3,250

Re: Connection String to SQL Server Not Working

[ Edited ]

What's your error message?

 

There's an old SAS Note that says you can't use encrypted passwords in connection strings:

 

http://support.sas.com/kb/31/602.html

 

Don't know if it is still the case or not. Maybe you could try moving the user and password outside of NOPROMPT in separate parameters as encryption in the PASSWORD parameter is allowed.

View solution in original post


All Replies
Solution
‎07-14-2017 11:03 AM
Super User
Posts: 3,250

Re: Connection String to SQL Server Not Working

[ Edited ]

What's your error message?

 

There's an old SAS Note that says you can't use encrypted passwords in connection strings:

 

http://support.sas.com/kb/31/602.html

 

Don't know if it is still the case or not. Maybe you could try moving the user and password outside of NOPROMPT in separate parameters as encryption in the PASSWORD parameter is allowed.

Super Contributor
Posts: 326

Re: Connection String to SQL Server Not Working

You are correct it seems including the encoded password does not work in the connection string. I had to do a manual work around that picks up the password from a file while supressing the log when assigning the librefs.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 132 views
  • 1 like
  • 2 in conversation