java.sql.SQLException: After end of result set in mysql

后端 未结 2 596
执念已碎
执念已碎 2020-12-04 02:14

I am trying to Download image (.png) file from MYSQL. some time it works fine.unable find exact problem. it works properly on Jboss server. throws an error while trying to r

2条回答
  •  抹茶落季
    2020-12-04 02:36

    You are calling result.next() twice. I'm assuming that your query returns only 1 row since you are trying to match by Userid. When the second result.next() is being called, there is no row to be returned in the ResultSet. This is why an SQLException is being thrown. Remove the 1st result.next() like so:

    result = st.executeQuery();
    if(!result.next()){
        input = result.getAsciiStream(1);
        }
    

提交回复
热议问题