Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling a java object fromn a store procedure no idea how to get it to work  RSS feed

Tony Evans
Ranch Hand
Posts: 598
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this piece of code, which works as a standalone program: It takes in the en_var and returns a path.

But it wont work when called from a store procedure
p = rt.exec("echo "+envar); returns null.
os = System.getProperty(""); returns Solaris
name = System.getProperty(""); returns null
home = System.getProperty("user.home"); returns null
dir = System.getProperty("user.dir"); returns null

import java.util.*;

class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
int bufSize = 4096;
byte buffer[] = new byte[bufSize];
String path = null;
Process p = null;
String os = null;
String name = null;
String home = null;
String dir = null;
SecurityManager sm = null;

int len = 0;

System.out.println("Calling echo "+envar);
os = System.getProperty("");
name = System.getProperty("");
home = System.getProperty("user.home");
dir = System.getProperty("user.dir");
sm = System.getSecurityManager();
p = rt.exec("echo "+envar);

BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
while ((len =, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
path = new String(buffer);
return path;
catch(Exception e)
System.out.println("Exception "+e);
return "ProcessProblem";

//path = "/rims/live/log";

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!