File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Data not Found error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data not Found error" Watch "Data not Found error" New topic
Author

Data not Found error

Andy Patoel
Greenhorn

Joined: Jul 09, 2004
Posts: 3
Ok, so I'm writing a JSP front-end that opens up a Java class (well, multiple classes with inheritance), and gets a value from an Access database (just for test). anyway, I can print the value to the screen as many times as I want when copied to a variable, and I can pass it around inside the program, but the minute I attempt to return the String, it pukes out. Here's my code:

try
{
// Creates an entirely new object to avoid pointer errors
String result = new String( results.getString( "FIELD_NAME" ) );

// Works with just any number of sys-outs, just proving it's not
// an issue with accessing it multiple times
System.out.println( result );
System.out.println( result );

return result;
} // error catching stuff next...

So what's going on here, why am I getting this error? Thanks for your help!
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
but the minute I attempt to return the String, it pukes out. Here's my code:

What exactly does that mean?
What exception are you getting?
Can you post the stack trace?

// Creates an entirely new object to avoid pointer errors

What pointer errors?


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Sutham Rojanusorn
Greenhorn

Joined: Jul 10, 2004
Posts: 4
I'm not sure about your question but may be

try {
....

yourstring = "your value";
} catch(Exception ex) {
yourstring = "default value";
} finally {
return yourstring;
}
Andy Patoel
Greenhorn

Joined: Jul 09, 2004
Posts: 3
What I did with the String thing is I thought perhaps my String was getting copied by pointer location and then maybe it was disappearing - not the case. I didn't put the stack trace on because I'm compiling on another computer - but basically when it hits the line that says return, it spits out a error like:

java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6238)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3292)
...


why can't I return the value to my JSP front-end?

Thanks,

Andy
arnel nicolas
Ranch Hand

Joined: Dec 16, 2003
Posts: 149
It is an SQLException, so somethings wrong with your SQL statement or the way you execute your SQL statement.This is just a guess. You may want posting you code here so we can look at it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data not Found error