• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

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("os.name"); returns Solaris
name = System.getProperty("user.name"); 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("os.name");
name = System.getProperty("user.name");
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 = bis.read(buffer, 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";

my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!