Architecting, installing and maintaining your SAS environment

SAS connecting to Microsoft SQL Server using DataDirect

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 410
Accepted Solution

SAS connecting to Microsoft SQL Server using DataDirect

I am trying connecting to SQL server database.

 

Have unixODBC driver manager installed + ODBC DataDirector connector installed on linux machine (SAS 9.4).

 

I can connect using isql command, but not with SAS job,

$isql -v [data srouce name] [user] [pwd]   <- can connect using this command.

 

I have ODBCINI /ODBCINST/LD_LIBRARY_PATH set up correctly under my home dir.

 

libname test odbc datasrc="datasourcenamefromodbcini" user="user1" pw="password";
ERROR: CLI error trying to establish connection: [iODBC][Driver Manager]Data source name not found and no default driver specified.
       Driver could not be loaded
ERROR: Error in the LIBNAME statement.

 

Am I missing anything? or different libname statement needs to be used? Thank you....

 

 


Accepted Solutions
Solution
‎03-23-2018 04:02 PM
SAS Employee
Posts: 61

Re: SAS connecting to Microsoft SQL Server using DataDirect

The runtime linker is loading the iODBC driver manager instead of the DataDirect one because the search path for the linker has the iODBC location ahead of the DataDirect one.

 

For details on how the linker works and how it finds dynamic libraries this Linux man page covers it all.

http://man7.org/linux/man-pages/man8/ld.so.8.html

 

Putting your DataDirect path first on the LD_LIBRARY_PATH will likely get you a step further in this setup.

export LD_LIBRARY_PATH=/opt/datadirect-install-dir/lib:$LD_LIBRARY_PATH

View solution in original post


All Replies
Occasional Contributor
Posts: 9

Re: SAS connecting to Microsoft SQL Server using DataDirect

Ensure LD_LIBRARY_PATH is correctly setup in the sasenv_local file under SAS Foundation directory.

Super Contributor
Super Contributor
Posts: 410

Re: SAS connecting to Microsoft SQL Server using DataDirect

Thanks Selvaraj. Do we need restart after adding it under sasenv_local file?

Occasional Contributor
Posts: 9

Re: SAS connecting to Microsoft SQL Server using DataDirect

Did you mean restarting the services? That won't be necessary. A new session would suffice.

Super Contributor
Super Contributor
Posts: 410

Re: SAS connecting to Microsoft SQL Server using DataDirect

I am still receiving same error,

 

My LD_LIBRARY_PATH looks like this,

 

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/datadirect-install-dir/lib

 

I started fresh session and tested. may be libname statement defined different way for odbc datadirect?

 

Solution
‎03-23-2018 04:02 PM
SAS Employee
Posts: 61

Re: SAS connecting to Microsoft SQL Server using DataDirect

The runtime linker is loading the iODBC driver manager instead of the DataDirect one because the search path for the linker has the iODBC location ahead of the DataDirect one.

 

For details on how the linker works and how it finds dynamic libraries this Linux man page covers it all.

http://man7.org/linux/man-pages/man8/ld.so.8.html

 

Putting your DataDirect path first on the LD_LIBRARY_PATH will likely get you a step further in this setup.

export LD_LIBRARY_PATH=/opt/datadirect-install-dir/lib:$LD_LIBRARY_PATH
Super Contributor
Super Contributor
Posts: 410

Re: SAS connecting to Microsoft SQL Server using DataDirect

Posted in reply to SimonDawson

Thanks Simon, worked fine.

☑ This topic is solved.

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

Discussion stats
  • 6 replies
  • 271 views
  • 0 likes
  • 3 in conversation