对于sql对象操作要用try catch捕捉错误!用下面的结构
try{
  ...
  while(..){
  }
}
catch(SQLException e){....}
catch(Exceptione e2){ .....}

解决方案 »

  1.   

    加上那个try{}catch(){}之后,我的bean还有错误运行错误如下:
    online.java:8: Return required at end of java.lang.String del(java.lang.String).
    public static String del(String sql){
                         ^
    1 error, 1 warning
      

  2.   

    那肯定是你加上那个try{}catch(){}之后
    有一种执行路径没有返回任何值
      

  3.   

    在bean中使用:
    try{
      ...
      while(..){
      }
    }
    catch(SQLException e)
    {....}
    catch(Exceptione e)
    { .....}
    finally{
      return results;
    }即可