Hi All,
We have SAS server under UNIX, if we access Microsoft SQL data via SAS/Access to Microsoft SQL data, is there a way does not need to edit ODBC.ini file?
I googled and found the following link, it seems we definitely still need to edit the ODBC.ini file even via SAS/Access to Microsoft SQL data (instead of the SAS/Access to ODBC)
http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001405609.htm
Please advise!
Thanks,
Jade
Here is a typical connection string we use for SAS under Windows and it completely defines the connection to SQL Server:
noprompt = "server=MyServerName;DRIVER=SQL Server;Trusted Connection=yes;"
We don't have Unix SAS so I can't try this for Unix. But if you removed Trusted Connection=yes and added uid= and password = you might get something close to what might work under Unix. I'm keen to know how you get on.
It is definitely possible for Windows SAS and this reference suggests it could be possible for Unix:
That is assuming SAS/ACCESS to SQL Server uses ODBC underneath.
You would usually use the NOPROMPT option say on a LIBNAME statement to specify the connection string however this reference says it is not supported under Unix:
I'd try this anyway just to confirm if it is correct or not. In my experience specifying database connections completely in a LIBNAME or CONNECT TO statement is way better than having to define DSNs elsewhere.
Thank you SASKiwi!
But the example in the reference using NOPROMPT still has DSN which I think should be defined in the ODBC.ini file, right?
libname mydblib sqlsvr noprompt="uid=myusr1;
pwd=mypwd1; dsn=sqlservr;" stringdates=yes;
So I think there is no way to avoid configuring ODBC.ini file, please correct me if I am wrong.
Thanks,
Jade
Here is a typical connection string we use for SAS under Windows and it completely defines the connection to SQL Server:
noprompt = "server=MyServerName;DRIVER=SQL Server;Trusted Connection=yes;"
We don't have Unix SAS so I can't try this for Unix. But if you removed Trusted Connection=yes and added uid= and password = you might get something close to what might work under Unix. I'm keen to know how you get on.
Thanks SASKiwi!
So the server name here is the real server name, not the name that set up in the ODBC file?
noprompt = "server=MyServerName;DRIVER=SQL Server;Trusted Connection=yes;"
We have SAS ODBC to SQL data installed in UNIX, now thinking add on SAS/Access to Micosoft SQL data to reduce the work load of admin ( if no need to edit the ODBC.ini file in UNIX, we have a lot servers and databases, really a lot to manage in the ODBC.ini file for admin)
Thanks,
Jade
Yes it is the "real" server name. If you use SQL Server Studio then it is the server name you enter to connect to your required databases.
Thank you, this is really helpful!
Jade
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.