• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data not Found error

 
Andy Patoel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sutham Rojanusorn
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic