kittu
kittu

Reputation: 7008

ORA-00911: invalid character while retrieving data from db

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)

Unable to figure where is the invalid character which is throwing the exception

Following is the query string:

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

Upvotes: 1

Views: 840

Answers (1)

Alex Poole
Alex Poole

Reputation: 191255

The semicolon is a statement separator. It should not be included when you execute a statement through JDBC (or OCI, etc.), which is what is happening in the background.

So where you currently execute this:

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

Change it to:

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

Upvotes: 3

Related Questions