当前位置:   article > 正文

java mysql结果集_java.sql.SQLException:在mysql中结果集结束后

java.sql.sqlexception: result has exceeded the maxrowcount limit

我正在尝试从MYSQL下载图像(.png)文件。有时它工作正常。无法找到确切的问题。它可以在Jboss服务器上正常工作。尝试在Apche上的本地计算机中运行时引发错误。

请帮助我修复错误。这是我的Java代码。

try {

conection = SQLUtil.createConnection(Constant.DataSourceName);

st = conection.prepareStatement("SELECT image FROM TABLE_NAME WHERE Userid="+ getUserId());

result = st.executeQuery();

result.next();

if(!result.next()){

input = result.getAsciiStream(1);

}

FileOutputStream output = new FileOutputStream(getSignatureImageDestinationPath());

int ch = input.read();

while (ch != -1) {

output.write((char) ch);

ch = input.read();

}

output.close();

input.close();

result.close();

SQLUtil.closeConnection(conection);

} catch (Exception e) {

System.out.println(e+":Error");

} finally {

if (st != null) {

SQLUtil.closeConnection(conection);

}

}

这是堆栈跟踪输出:

java.sql.SQLException: After end of result set

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)

at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:854)

at com.mysql.jdbc.ResultSetImpl.getAsciiStream(ResultSetImpl.java:1275)

at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getAsciiStream(DelegatingResultSet.java:253)

at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getAsciiStream(DelegatingResultSet.java:253)

at com.ninenexus.model.Signature.getSignatureImage(Signature.java:173)

at com.ninenexus.servlets.SaveMySignature.mySignatureDisplay(SaveMySignature.java:69)

at com.ninenexus.servlets.SaveMySignature.doPost(SaveMySignature.java:35)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/820155
推荐阅读
相关标签
  

闽ICP备14008679号