BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lfabbri
Obsidian | Level 7

Hello everyone, I've successfully created an ODBC library in SAS Management Console 9.4 to read/write data in a Microsoft Sql Server database.

The library seems correctly configured, I can register tables from the MSSql database.

This is the LIBNAME statement:

 

LIBNAME bdpapl ODBC  NOPROMPT="dsn=MSSQL_BDPAPL;Trusted_Connection=yes"  SCHEMA=DBO ;

 

In SAS Data Integration Studio I've successfully created and executed a job that reads and writes data using tables registered with this library.

My problem is that when other SAS users want to execute similar operations, they got a failure with the following errors:

 

  Line 129: ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

  Line 129: ERROR: Error in the LIBNAME statement.

  Line 133: ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

  Line 133: ERROR: Error in the LIBNAME statement.

  Line 161: ERROR: Libref BDPAPL is not assigned.

   

 I verified that all the SAS users can see the library and the associated registered tables in the Inventory menu of Data Integration Studio, but for some reasons the job fail when they try to execute.

 

What have I to do to make the ODBC library working for all the SAS users?

 

Thanks for any help

1 ACCEPTED SOLUTION

Accepted Solutions
AngusLooney
SAS Employee

So, your libname is using the DSN created as User DSN, so it will only work for your account. If it were calling a System DSN it would work for all users.

 

From the looks of things, using 'sqlserver_native_client' in place of 'MSSQL_BDPAPL' ought to fix it - assuming the sqlserver_native_client points to the right database/schema etc.

 

I think....

View solution in original post

6 REPLIES 6
AngusLooney
SAS Employee

Did you create a USER or SYSTEM DSN in the ODBC manager?

 

User = only accessible to the relevant uses

System = accessible across all users

 

I've seen this be the cause of this sort of thing in the past.

lfabbri
Obsidian | Level 7

 

Hi, thanks for the reply.

Can you elaborate? This is what I've got in the ODBC administrator:

 

odbc_system_dsn.pngodbc_user_dsn.png

AngusLooney
SAS Employee

So, your libname is using the DSN created as User DSN, so it will only work for your account. If it were calling a System DSN it would work for all users.

 

From the looks of things, using 'sqlserver_native_client' in place of 'MSSQL_BDPAPL' ought to fix it - assuming the sqlserver_native_client points to the right database/schema etc.

 

I think....

lfabbri
Obsidian | Level 7

The error indeed was the use of a User DSN instead of a System DSN. Thank you!

SASKiwi
PROC Star

@lfabbri - If you would like to try ODBC connections to SQL Server without using DSNs and the ODBC Administrator at all try this:

 

libname sqlsrvr odbc noprompt = "server=MyServerName;DRIVER=SQL Server Native Client 10.0;Trusted_Connection=yes;" qualifier = "MyDatabase" schema = "MySchema";

 

 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 6 replies
  • 3794 views
  • 2 likes
  • 3 in conversation