通过statement方法可快速实现,但调用preparestatement方法后持续报错。代码部分为: 运行后异常: 重点:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘? and JOB = ?’ at line 1 多次显示sql语句错误,经过一整天的探索终于发现了原因:ps.executeQuery方法中,不需要参数sql!!!!!! 修改后运行成功。