Hi all,
I am changing the infernal and external connections manually, is there a way we can do it via code?
https://documentation.sas.com/doc/en/bicdc/9.4/bimtag/n1s9ty2ykoxyr5n1ikt28hcjwuuz.htm
Yes, I wrote this program a while ago that updated the port/protocol for these, so it would find any with http/7980 and updated to https/8343, but you could update other attributes as well:
/* ---------------------------------------- [ reset_protocol.sas ] ---------------------------------------- *
* The purpose of this program is to locate web connection info defined in Metadata and update the protocol *
* and port. *
* Author: Greg Wootton Date: 26SEP2019 *
* Note: This is experimental. Use at your own risk. *
* -------------------------------------------------------------------------------------------------------- */
/* Define macro variables for Metadata connection information and the protocols and ports that need changing.*/
%let metaserve=meta.demo.sas.com;
%let metaport=8561;
%let userid=sasadm@saspw;
%let pass=password;
%let oldprotocol='http';
%let newprotocol='https';
%let oldport='7980';
%let newport='8343';
/*End edit. */
/* Define Metadata connection information. */
options metaserver="&metaserve"
metaport=&metaport
metaprotocol='bridge'
metauser="&userid"
metapass="&pass"
metarepository='Foundation'
metaconnect='NONE'
;
/* Take an ad-hoc Metadata backup. */
PROC METAOPERATE ACTION=refresh options="<BACKUP COMMENT='METAOPERATE backup'/>" noautopause;
RUN;
/* Define a search that only returns objects defined with the old protocol and port. */
%let query="omsobj:TCPIPConnection?@CommunicationProtocol=&oldprotocol and @Port=&oldport";
/* For each, change the protocol to the new one. */
data _null_;
length type id uri $ 50 ;
call missing (of _character_);
count=metadata_resolve(&query,type,id);
put "NOTE: Found " count "connections to update.";
if count > 0 then do n=1 to count;
rc=metadata_getnobj(&query,n,uri);
rc=metadata_setattr(uri,"CommunicationProtocol",&newprotocol);
rc=metadata_setattr(uri,"Port",&newport);
end;
run;
Yes, I wrote this program a while ago that updated the port/protocol for these, so it would find any with http/7980 and updated to https/8343, but you could update other attributes as well:
/* ---------------------------------------- [ reset_protocol.sas ] ---------------------------------------- *
* The purpose of this program is to locate web connection info defined in Metadata and update the protocol *
* and port. *
* Author: Greg Wootton Date: 26SEP2019 *
* Note: This is experimental. Use at your own risk. *
* -------------------------------------------------------------------------------------------------------- */
/* Define macro variables for Metadata connection information and the protocols and ports that need changing.*/
%let metaserve=meta.demo.sas.com;
%let metaport=8561;
%let userid=sasadm@saspw;
%let pass=password;
%let oldprotocol='http';
%let newprotocol='https';
%let oldport='7980';
%let newport='8343';
/*End edit. */
/* Define Metadata connection information. */
options metaserver="&metaserve"
metaport=&metaport
metaprotocol='bridge'
metauser="&userid"
metapass="&pass"
metarepository='Foundation'
metaconnect='NONE'
;
/* Take an ad-hoc Metadata backup. */
PROC METAOPERATE ACTION=refresh options="<BACKUP COMMENT='METAOPERATE backup'/>" noautopause;
RUN;
/* Define a search that only returns objects defined with the old protocol and port. */
%let query="omsobj:TCPIPConnection?@CommunicationProtocol=&oldprotocol and @Port=&oldport";
/* For each, change the protocol to the new one. */
data _null_;
length type id uri $ 50 ;
call missing (of _character_);
count=metadata_resolve(&query,type,id);
put "NOTE: Found " count "connections to update.";
if count > 0 then do n=1 to count;
rc=metadata_getnobj(&query,n,uri);
rc=metadata_setattr(uri,"CommunicationProtocol",&newprotocol);
rc=metadata_setattr(uri,"Port",&newport);
end;
run;
Thanks for this
I am looking for protocal, port and hostname so what about the Host Name?
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.