出现的错误

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 '?'

出现这种错误的原因是在执行sql的时候使用了pstmt.executeQuery(sql)这个实际上是statement的方法,不支持?号占位符,所以正确的使用是pstmt.executeQuery()

你可能感兴趣的:(sql,mysql,SQL Server)