执行会出现以下错误信息
java.sql.SQLSyntaxErrorException: 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 loginPwd = ?' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1200)
at JDBCTest07.login(JDBCTest07.java:45)
at JDBCTest07.main(JDBCTest07.java:22)
错误的原因是:在执行prepareStatement的时候已经传入sql了,执行excuteQuary时又传入一遍
修改后正常执行