How do I connect to DB2 library from Base SAS

Reply
Occasional Contributor
Posts: 13

How do I connect to DB2 library from Base SAS

Hi there,

I am very new to SAS and am having difficulties connecting to a DB2 library from Base SAS.

We have recently installed the SAS/ACCESS Interface to DB2, so can successfully connect in EG by using the following code:

LIBNAME XXXXXXXX DB2 DATASRC=XXXXXXXX USER=XXXXXXXX PASSWORD=XXXXXXXX

SCHEMA=XXXXXXXX;

I am thinking I could use something similar in Base SAS but I would probably need to remotely connect or submit first, which I am not very familiar with.

Is someone out there able to assist me or send through the syntax I should be using? I have tried some of the suggestions out there in forums, but no luck as yet.

Thanks in advance,

Vinnie

Super User
Posts: 19,869

Re: How do I connect to DB2 library from Base SAS

Posted in reply to Vinnie_MOH

Try the following, I think it follows this structure but not 100% sure. You need to know your server name

*set up on server;

rsubmit;

LIBNAME TEST DB2 DATASRC=XXXXXXXX USER=XXXXXXXX PASSWORD=XXXXXXXX

SCHEMA=XXXXXXXX;

endrsubmit;

*add local reference to server library;

libname test slibref=test server=serverName;

Occasional Contributor
Posts: 13

Re: How do I connect to DB2 library from Base SAS

Thanks for that Reeza. I had to update my code to connect to the metaserver first, but what you sent through helped.

Ask a Question
Discussion stats
  • 2 replies
  • 346 views
  • 3 likes
  • 2 in conversation