File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP JSTL to Oracle Connectivity Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP JSTL to Oracle Connectivity Error" Watch "JSP JSTL to Oracle Connectivity Error" New topic

JSP JSTL to Oracle Connectivity Error

Kailash karayat

Joined: Jun 22, 2012
Posts: 10

I am using oracle 10g as database and i want to use jstl for database access.

i have the following program which is giving error message.

The exception is : javax.servlet.jsp.JspException: SELECT * from EMPLOYEES; : ORA-00911: invalid character
There is an exception: SELECT * from EMPLOYEES; : ORA-00911: invalid character

the program is

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<%@ page import="*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="" prefix="c"%>
<%@ taglib uri="" prefix="sql"%>

<sql:setDataSource var="db"
<c:catch var ="catchException">
<sql:query var="result" dataSource="${db}" >
The exception is : ${catchException} <br />
There is an exception: ${catchException.message}
<title>JSTL sql:query Tag</title>

<table border="1" width="100%">

<th>First Name</th>
<th>Last Name</th>

<c:forEach var="row" items="${result.rows}">

<td><c:out value="${row.first}"/></td>
<td><c:out value="${row.last}"/></td>


Stefan Evans

Joined: Jul 06, 2005
Posts: 1580
my guess on the invalid character would be the ';'
Try removing that and see if it works.

Having said that though, running sql queries through a JSP is not the best approach.
Using JSTL is better than using scriptlets, I'll grant you that, but even in the JSTL specification they state that these tags should only be used from demos and small projects.
You would be better off writing a data access layer in java.

I agree. Here's the link:
subject: JSP JSTL to Oracle Connectivity Error
It's not a secret anymore!