This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can your java function return a resultset?

 
Charlie Boss
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My query is retrieving a recordset. I want to pass this recordset around so i can do some processing on it. However my compiler complains that my methods (set to return java.sql.ResultSet) have no return statements.
Any ideas on how i can return a java.sql.ResultSet??
 
Butch Car
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check to make sure that you are actually returning
the ResultSet.

public java.sql.ResultSet executeQuery(java.lang.String SQL)
throws SQLException
{
java.sql.ResultSet _rs = null;
java.sql.Statement _stmt = null;

try
{
_stmt = _con.createStatement();
_rs = _stmt.executeQuery( SQL );
}
catch (SQLException e)
{
throw e;
}
finally
{
<snip>
}
return _rs;
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic