soyiranyou
sweetyi
2015-03-21 10:47
采纳率: 25%
浏览 2.1k

安卓开发报错Illegal operation on empty result set.

各位大神,我在myeclipse里编写服务器,报如下错误:
url = select * from user where username = 'null'
stmt = com.mysql.jdbc.Statement@39c51b0e
java.sql.SQLException: Illegal operation on empty result set.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:685)
at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:5476)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:5420)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:5436)
at com.test.servlet.loadMessage.doLogin(loadMessage.java:81)
at com.test.servlet.loadMessage.doGet(loadMessage.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
result = {"result_code":2}
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2442)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2431)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

菜鸟刚开始学,求各位大神指点啊啊啊
错误代码可能在这里,但是没看出来哪里错了。。。。

String doLogin(String username,
String password) {

    HashMap<String, Object> resultMap = new HashMap<String, Object>();
    String sql = "select * from " + DBManager.TABLE_NAME + " where " + DBManager.COLUMN_USERNAME + " = " + "'" + username + "'" ;
    System.out.println("url = " + sql);
    。。。。。。
    }
    username这个变量是个参数啊,它的使用在这里:感觉也没错啊:

    String username = request.getParameter("username");
    String password = request.getParameter("password");
    String result = doLogin(username, password);
    不懂,求教!!!
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • u012216727
    大河行脚 2015-03-21 13:24
    已采纳

    你说的错误是:非法操作空字符集
    我想知道你的sql执行呢?
    还有提示的错误是创建sql异常;

    如果回答对您有帮助,请采纳

    点赞 评论

相关推荐