BookmarkSubscribeRSS Feed
mpordon
Fluorite | Level 6

In a set of code we have we define a libref to a Sybase server in the beginning and use the 'connect using' syntax to run explicit pass-through code on the server. Originally the libref was defined using ODBC as below along with an example of how we were running pass-through code:

libname Server odbc required="driver=Adaptive Server Enterprise;server=[SERVER];port=[PORT];database=[DATABASE];logonid=[ID];password=[PASSWORD];charset=iso_1;" schema=dbo;
proc sql;
	Connect using Server;
	Select
		*
	From
		Connection to Sever
		(
			Select
				8
			From
				SomeTable
		);	
quit;

 

 

Recently we were asked to start using proc pwencode to encode our passwords so that they did not need to be stored as plaintext. To my knowledge the SAS encoded passwords do not work in the 'required' parameter so we switched the libref declaration to:

libname Server sybase USER=[ID] PASSWORD="[PASSWORD]" SERVER=[SERVER] DATABASE=[DATABASE] schema=dbo;
proc sql;
	Connect using Server;
quit;

 

The libname statement works as expected and I can navigate to tables on the server via the explorer. However, the attempt to connect using the libname via proc sql now generates an error:

Pass Through Error.png

 

The odd thing is that using 'connect to' and redefining the connection works:

proc sql noprint;
  connect to SYBASE(USER=[ID]
                    PASSWORD=[PASSWORD]
                    SERVER=[SERVER]
                    DATABASE=[DATABASE]);
quit;

Has anyone experienced this sort of issue with SAS/Access for Sybase before? This is all running on SAS 9.4 M2.

 

3 REPLIES 3
JBailey
Barite | Level 11

Hi @mpordon 

 

This is a guess; I haven't tried this, but change the Libref Server to a different name. It looks like something could be getting discombobulated because of a reserved keyword. 

libname myServ sybase USER=[ID] PASSWORD="[PASSWORD]" 
SERVER=[SERVER] 
DATABASE=[DATABASE] 
schema=dbo;

proc sql;
	Connect using myServ;
quit;

Best wishes,
Jeff

 

mpordon
Fluorite | Level 6

Unfortunately that is not the problem. I had changed the name of the libref before posting the code just to make it as generic as possible. Normally it is the name of the actual server that is not a reserved word.

JBailey
Barite | Level 11

Hi @mpordon 

 

I think your Sybase interfaces file is pointing to an incorrect server (or there is some other setup problem). There may be missing environment variables. You can try connecting with isql and it will probably give you the same error message. 

 

Here is a snippet from an interfaces file:

MYSERVER
        master tcp ether myserver 5000
        query tcp ether myserver 5000

Connecting with isql is a good test because it takes SAS out of the picture.

 

Link to the SAP doc describing isql

 

Make sure the environment variables are correct.

 

SAS 9.4 Configuration Guide for Linux


Hope this helps,
Jeff

SAS Innovate 2025: Register Now

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!

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
  • 3 replies
  • 1265 views
  • 0 likes
  • 2 in conversation