ORA-00911:从db检索数据时无效字符

时间:2015-05-19 10:13:08

标签: java oracle jsp

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: 
SELECT * from Employees;
: ORA-00911: invalid character

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: 
SELECT * from Employees;
: ORA-00911: invalid character

    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:864)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:797)
    org.apache.jsp.select_jsp._jspService(select_jsp.java:109)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

无法确定抛出异常的无效字符在哪里

以下是查询字符串:

<sql:setDataSource var="orcl" driver="oracle.jdbc.driver.OracleDriver"
     url="jdbc:oracle:thin:@192.168.6.132:1521:orcl"
     user="jsp" password="jsp"/>

<sql:query dataSource="${orcl}" var="result">
SELECT * from Employees;
</sql:query>

1 个答案:

答案 0 :(得分:3)

分号是一个语句分隔符。当您通过JDBC(或OCI等)执行语句时,不应该包含它,这是后台发生的事情。

所以你现在执行的地方是:

<sql:query dataSource="${orcl}" var="result">
SELECT * from Employees;
</sql:query>

将其更改为:

<sql:query dataSource="${orcl}" var="result">
SELECT * from Employees
</sql:query>