BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am not a SAS programmer, user, or administrator and I know very little about SAS in general (not ideal, but that's how it is right now). I am developing a Java application which needs to connect to a SAS stored process server (pooled from the metadata server), execute a stored process and handle the results. Not a web app, just a plain old command line single method java application. Using the STP web app is not an option, the portal and web layer are not installed. I was hoping the SAS site would have a complete example of doing this, but I wasn't able to find one.

I started with "Connecting with Server Attributes Read from a SAS Metadata Server"
http://support.sas.com/rnd/itech/doc9/dev_guide/dist-obj/javaclnt/javaprog/connfact_omr.html

Instead of specifying the workspace server's logical name login015Logical, I specified the load balanced stored process server's logical name.

I then narrow the object and get a reference to the stored process server instead of the workspace server:
IStoredProcessServer stpServer = IStoredProcessServerHelper.narrow(obj);

I then create the context for the stored process (com.sas.iom.SASStoredProcess.IStoredProcessContext), which seems to take the physical locations, not the logical locations

StringHolder arg0 = new StringHolder();
String[] names = {};
String[] values = {};
String sessionId = "";
String repos = "/var/sasrepo";
String process = "test.sas";
IStoredProcessContext stpContext= stpServer.CreateContext(repos, process,names, values, sessionId);

Following that I execute it with
stpContext.Execute(arg0);

Now, this works, the stored process is executed from what I can tell... using stpContext.GetFormattedSasLog returns the expected log results.

What I am unsure of is how to get the resulting dataset from the stored process. Using the Workspace server from the original example I would do a executeWithResults and get a ResultSet back or grab a Connection and select results from work.out. With the IStoredProcessContext object I'm not sure how to go about retreiving results or how/what the stored process coder needs to send the results to within the process.

Compounding this problem is there appears to be no documentation for IStoredProcessServer, IStoredProcessContext and their related classes.

Am I barking up the wrong tree? Is there a simpler way to execute processes on a pooled stored process server using the metadata server to get the connection... is there a complete example? I can imagine people have done this and I am just missing some easier way to do it, but I've gone over all the documentation I can find and am sad to say I'm just not seeing it.
1 REPLY 1
Vince_SAS
Rhodochrosite | Level 12
Try contacting our Technical Support department. They may have some starter code for you to try:

http://support.sas.com/ctx/supportform/index.jsp

Vince DelGobbo
SAS R&D

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 1493 views
  • 0 likes
  • 2 in conversation