Hello,

I call a java function from a stored procedure, but an error for an exception is generated. Below are the code and error log, it seems I am not allowed to call first() on result set. What's wrong with this?

Log message :
java.sql.SQLException: [IBM][JDBC .......] CLI0627E ............ ..... .. . ...........
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwNo tScrollable(SQLExceptionGenerator.java:763)
at COM.ibm.db2.jdbc.app.DB2ResultSet.first(DB2ResultS et.java:3207)
at F_SYS.f_sys_langid(f_sys_langid.java:17)

Code:
import java.sql.*;

class F_SYS
{
public static int f_sys_langid()
throws SQLException
{
int outparm;
Connection con = DriverManager.getConnection( "jdbc:default:connection" );
PreparedStatement stmt = null;
String sql = "select Lang_ID from SESSION.glb_sysinfo fetch first ROW ONLY";

stmt = con.prepareStatement( sql );

ResultSet rs = stmt.executeQuery();
rs.first();
outparm = rs.getInt(1);
if (rs != null) rs.close();

if (stmt != null) stmt.close();
if (con != null) con.close();

return outparm;
}
}