如提,我在servlet里调用该方法,根据返回值进行跳转,但是总是返回false;
而数据库确实已经更新,且没有报错

解决方案 »

  1.   

    返回false就对了,
    true if the first result is a ResultSet object; false if the first result is an update count or there is no resultexecute method returns a boolean to indicate the form of the first result. You must call either the method getResultSet or getUpdateCount to retrieve the result; you must call getMoreResults to move to any subsequent result(s).
      

  2.   

    上面是API对excute的说明,当返回ResultSet的时候才返回ture,而当是update,delete,insert等等的时候,返回值为false
    建议用executeUpdate()来执行,其返回值为更新的记录数
      

  3.   

    同意楼上的!
    一般都用executeUpdate()或executeQuery()
      

  4.   

    有收获。execute() vs executeUpdate() vs executeQuery