• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anyone know Unidata?

 
Mike Kay
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can get a users email address by performing the following

STMT="/usr/local/bin/getid -I -e ":USRNAME

PCPERFORM STMT CAPTURING JUNK

EM.ADDR=JUNK<1,1,1>

but I want to be able to get that via my Java program when the user logs in to the website. I just want it to be able to retrieve their email address and store it in an email varible that I can use throughout the web pages.

Is this possible?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,
But this is a servlets forum.

I'll move this to the JDBC form (which is the best place to ask database questions)
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you already looked into the various middleware products (Redback, UniObjectsForJava, the JDBC interface,...) for U2 databases?
If so, which are you using?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wait, are trying to do this with Unidata and then pass the results to Java or are you just trying to find the Java equivalent to PCPERFORM?

If it's the latter, look at Runtime.exec()
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
 
Mike Kay
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm importing asjava.uniobjects.*;
asjava.uniclientlibs.*;


I'm learning this whole Java language, so I am very new to it. I tried using the perform in a pic program and then use

UniSubroutine getemailAddress = uSession.subroutine("GETEMAIL", 3);

try {
getemailAddress.setArg(0, STMT);
getemailAddress.setArg(1, user);<---this was assigned when they login
getemailAddress.setArg(2, RESULT);
getemailAddress.call();
EMAILADDRESS = getemailAddress.getArg(2);
} catch (UniSubroutineException e) {
return valid;
}


to get the results. but I kept getting a you must use caught error. I was wondering if I could just perform the statement via java or whatever the best way to do it is.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to get the results. but I kept getting a you must use caught error.


Can you post the exact error?
I'm guessing that the method you're calling throws exceptions that you haven't caught.
 
Mike Kay
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java:75: unreported exception asjava.uniobjects.UniSubroutineException;
must be caught or declared to be thrown
getemailAddress.call();
^
java:76: unreported exception asjava.uniobjects.UniSubroutineException;
must be caught or declared to be thrown
emailAddress = getemailAddress.getArg(2);


I might rather use the getRuntime() command.

getRuntime()...........Is this the best way to get the result into
the variable emailAddress?

String[] cmd = {"/usr/local/bin/getid -I -e :", usr};
emailAddress.getRuntime().exec(cmd);
 
Mike Kay
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
reading more about this getruntime. I see I need to then process the return and make sure I send the correct arguments. I'll have to research this more I guess.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Kay:
java:75: unreported exception asjava.uniobjects.UniSubroutineException;
must be caught or declared to be thrown
getemailAddress.call();
^
java:76: unreported exception asjava.uniobjects.UniSubroutineException;
must be caught or declared to be thrown
emailAddress = getemailAddress.getArg(2);


I might rather use the getRuntime() command.

getRuntime()...........Is this the best way to get the result into
the variable emailAddress?

String[] cmd = {"/usr/local/bin/getid -I -e :", usr};
emailAddress.getRuntime().exec(cmd);




It sounds like one of your methods has a throws clause for UniSubroutineException but you none of the code in that method actually throws that exception.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic