TPBAFK TPBAFK - 2 years ago 183
SQL Question

JSP Create [ java.sql.SQLSyntaxErrorException: Syntax error: Encountered ";" at line 1, column 23.]

I'm creating a web application about crud using this source in java with using jsp on netbeans and i'm gettin sql syntax error, am i supposed to do create a servlet ? or what ? i couldn't understand and i know there is have post in the forum but this is different can someone help me please ?

<%@ page import = "java.io.*,java.util.*,java.sql.*"%>
<%@ page import = "javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix = "c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix = "sql"%>

<html>
<head>
<title>SELECT Operation</title>
</head>

<body>
<sql:setDataSource var = "snapshot" driver =
"org.apache.derby.jdbc.ClientDriver"
url = "jdbc:derby://localhost:1527/school"
user = "root" password = "123" />

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

<table border = "1" width = "100%">
<tr>
<th>Name : </th>
<th>Last Name : </th>
<th>Grade : </th>
<th>Age : </th>
</tr>

<c:forEach var = "row" items = "${result.rows}">
<tr>
<td><c:out value = "${row.NAME}"/></td>
<td><c:out value = "${row.LASTNAME}"/></td>
<td><c:out value = "${row.GRADE}"/></td>
<td><c:out value = "${row.AGE}"/></td>
</tr>
</c:forEach>
</table>

</body>



Answer Source

try to remove ; from the query let it be : SELECT * from STUDENTS

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download