aspose file tools*
The moose likes JDBC and the fly likes Can your java function return a resultset? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can your java function return a resultset?" Watch "Can your java function return a resultset?" New topic
Author

Can your java function return a resultset?

Charlie Boss
Ranch Hand

Joined: May 22, 2001
Posts: 44
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??


Java Rawks
Butch Car
Greenhorn

Joined: Jan 12, 2001
Posts: 13
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;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can your java function return a resultset?