转自:https://blog.csdn.net/x279114012/article/details/78899825
今天用java查询Oracle数据库,出现java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符。
select password from users_xzj where name = 'zhangfei';
java.sql.SQLSyntaxErrorException: ORA-00911: 无效字符
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:852)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1477)
at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:392)
at oracleday07.TestLoad.check(TestLoad.java:28)
at oracleday07.TestLoad.main(TestLoad.java:66)
后来度娘了一下,发现原来是拼写SQL语句时,多了一个 “ ; ”
"select password from users_xzj where name = '" + uname + "';";
这里不能写 ';'。要注意,插入语句也是一样
---------------------
作者:嘻嘻哈a
来源:CSDN
原文:https://blog.csdn.net/x279114012/article/details/78899825
版权声明:本文为博主原创文章,转载请附上博文链接!