pstmt.getGeneratedKeys()更换jar包后报错 改成: pstmt=conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS); rs=pstmt.getGeneratedKeys(); 即可!