BookmarkSubscribeRSS Feed
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 = "";
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? 







Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 0 replies
  • 1 in conversation