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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 0 replies
  • 546 views
  • 0 likes
  • 1 in conversation