java.sql.SQLException: ORA-00911: 无效字符

这是我在开发一个Struts项目中用到一个与Oracle交互时出现了这个错误

当时找了半个小时的错误所以写上让出了同样的错误的朋友快速解决


java.sql.SQLException: ORA-00911: 无效字符

 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
 at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
 at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
 at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
 at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
 at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
 at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
 at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
 at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
 at com.spring.services.UserBusiness.loginAction(UserBusiness.java:63)
 at com.spring.services.UserBusiness.main(UserBusiness.java:27)

这是因为用了好长时间的Oracle的关系所以写语句时总要加上';'号这时就出了这个错,快点解决吧

StringBuilder sql = new StringBuilder()
   .append("select * from emp where uname=? and upass=?;");

改成:

StringBuilder sql = new StringBuilder()
   .append("select * from emp where uname=? and upass=?");

行了

 

posted @ 2009-02-12 21:42  王春天  阅读(3180)  评论(0编辑  收藏  举报
云推荐