BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

A simple way to connect to an Oracle table is to use the follow SAS code:

 

LIBNAME myora ORACLE PATH=orasrv USER=myuse PW=mypassword:

 

But what is the best way to protect the username and password so nobody can see their values.

Please provide an example. 

5 REPLIES 5
SASKiwi
PROC Star

How secure do you want your password to be? PROC PWENCODE is one option:

proc pwencode in = 'mypassword';
run;

SASKiwi_0-1695337557556.png

Just replace the PW text in your LIBNAME with {SAS002}68B279564BD2695538CDCDB301E8A357563480B0

 

This wont prevent someone just copying and pasting your LIBNAME into their own code though.

 

SASKiwi
PROC Star

Another more secure option is to create a new Authentication Domain in SAS metadata, within a new metadata User Group, then add an Oracle account and password to use for the whole group. You then add all SAS users allowed to access Oracle to this new user group. You need to have administrator access to SAS Management Console to be able to set this up and you also need a shared account for Oracle access - one that is shared across all users in Oracle SAS user group. You would need approval from your IT security folks to obtain this. Your LIBNAME would now look similar to this: 

libname MyOracle Authdomain = OracleAuth;

 

Tom
Super User Tom
Super User

A few methods.

 

Store the password into an environment variable and use %SYSGET() to pass it to the LIBNAME statement.  

LIBNAME myora ORACLE PATH=orasrv USER=myuse PW="%sysget(mypassword)";

Note you might want to use this %QSYSGET() macro if your passwords are messy.

 

Store the password into a file (with proper access permissions) and read from the file to generate the libref.  You could just use it to generate a LIBNAME() function call.

data _null_;
   infile 'mypassword' ;
   input;
   rc = libname('myora','ORACLE',,catx(' ','PATH=orasrv USER=myuser PW=',quote(trim(_infile_))));
run;

For ORACLE try defining an ORACLE WALLET and use that to connect.

mightydron
Calcite | Level 5

Securing passwords in SAS is super important these days. It's like having a guard dog for your online accounts! These tools help you create passwords that are tough for hackers to crack.

mightydron
Calcite | Level 5

One easy way to do it is to use a strong password checker. Here's a tip: try to mix it up with a combo of letters, numbers, and symbols. Avoid using easy stuff like your pet's name or "password123". Plus, don't forget to change your password regularly to keep those sneaky cyber folks guessing. Another cool trick is using two-factor authentication when you can. It adds an extra layer of security, like having a secret code to get into your clubhouse.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 816 views
  • 0 likes
  • 4 in conversation