Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes Anyone know Unidata? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Anyone know Unidata?" Watch "Anyone know Unidata?" New topic
Author

Anyone know Unidata?

Mike Kay
Greenhorn

Joined: Jun 27, 2006
Posts: 6
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

Joined: Dec 11, 2004
Posts: 13410

Yes,
But this is a servlets forum.

I'll move this to the JDBC form (which is the best place to ask database questions)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Jun 27, 2006
Posts: 6
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Jun 27, 2006
Posts: 6
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

Joined: Jun 27, 2006
Posts: 6
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

Joined: Dec 11, 2004
Posts: 13410

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anyone know Unidata?