BookmarkSubscribeRSS Feed
ablash
Calcite | Level 5

I am trying to interact with SAS server using Java Client. I am able to establish the connection using Java Connection Factory. Once the connection is established, I need to  resuse the same session or IWorkspace object created for consecutive calls to SAS server and close the session whenever I need. The session must be active till I close the session. 

Below is the code I use to establish the connection: 

 

 

// identify the IOM server
String classID = Server.CLSID_SAS;
String host = "rnd.fyi.sas.com";
int port = 5310;
Server server = new BridgeServer(classID,host,port);

// make a connection factory configuration with the server
ConnectionFactoryConfiguration cxfConfig =
   new ManualConnectionFactoryConfiguration(server);

// get a connection factory manager
ConnectionFactoryManager cxfManager = new ConnectionFactoryManager();

// get a connection factory that matches the configuration
ConnectionFactoryInterface cxf = cxfManager.getFactory(cxfConfig);

// get the administrator interface
ConnectionFactoryAdminInterface admin = cxf.getAdminInterface();

// get a connection
String userName = "abcserv";
String password = "abcpass";
ConnectionInterface cx = cxf.getConnection(userName,password);
org.omg.CORBA.Object obj = cx.getObject();
IWorkspace iWorkspace = IWorkspaceHelper.narrow(obj);

I need to somehow persist the IWorkspace object or some way to get the same IWorspace object and reuse the same object for all the consecutive calls. Please let me know, how this can be achived. 

When I use WorkspaceConnector to create the IWorkspace Object, there is a way to get the Iworkspace object by using below code:

WorkspaceConnector connector = WorkspaceFactory.getWorkspaceConnectorByUUID(UniqueIdentifier);
IWorkspace iworkspace = connector.getWorkspace();

where UniqueIdentifier is the identifier for getting workspace created previously. Is there any similar way to get Iworkspace object when I use Java Connection Factory? 

 

 

Thanks,

Abhilash

sas-innovate-wordmark-2025-midnight.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. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 671 views
  • 0 likes
  • 1 in conversation