Desktop productivity for business analysts and programmers

ODBC SQL server libname issue

Frequent Contributor
Posts: 85

ODBC SQL server libname issue


I have an odbc connection at my desktop and I don't need username and password for that when I use libname in base sas .

Libname risk odbc dsn="risk" user="" password="" schema=dbo;

This works perfectly fine

However when I try to use the same using eg it gives me error

Ports are opened in our server and we have odbc engine in place

I really don't understand what could be the issue . it gives me CLI error

Any suggestions are welcome

Super User
Posts: 24,003

Re: ODBC SQL server libname issue

Posted in reply to forumsguy

Is EG on your desktop or is it a Server Installation?

If it's a server installation it may not see your dsn connection.

Posts: 401

Re: ODBC SQL server libname issue

Posted in reply to forumsguy

Similar to what Reeza said, if the libname statement works in Base SAS, and EG is connecting to SAS on the same machine (either locally or remotely), then submitting the same libname statement in EG (to the same server) should work.

For example, if Base SAS and EG is on your local machine, the same libname statement should work in both (so long as you are submitting to the "Local" server in EG).

If EG is on your local machine and you are submitting to a remote server, then the libname statement will work in EG if it also works in Base SAS installed on the server machine.

In other words, the DSN has to exist on the host machine where the SAS server process is running.

Super User
Posts: 4,022

Re: ODBC SQL server libname issue

Posted in reply to forumsguy

If you would like to avoid defining DSNs on all of your SAS local or remote SAS servers you can just do it all in your LIBNAME - note you will need to substitute RiskServerName and RiskDatabase with your actual values as defined in your DSN (stored in the ODBC Administrator tool).

libname risk odbc noprompt = "server=RiskServerName;DRIVER=SQL Server Native Client 11.0;Trusted Connection=yes" DATABASE = RiskDatabase schema = dbo;

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation