Connection - HTTP Status 500 error
Hi, getting the following error??
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6197: An error occurred at line: 43 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:///index_jsp.java:104: ')' expected
PWC6197: An error occurred at line: 43 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:///index_jsp.java:104: not a statement
PWC6197: An error occurred at line: 43 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:///index_jsp.java:104: ';' expected
PWC6199: Generated servlet error:
string:///index_jsp.java:122: 'catch' without 'try'
PWC6199: Generated servlet error:
string:///index_jsp.java:122: ')' expected
PWC6199: Generated servlet error:
string:///index_jsp.java:122: not a statement
PWC6199: Generated servlet error:
string:///index_jsp.java:122: ';' expected
PWC6199: Generated servlet error:
string:///index_jsp.java:130: 'finally' without 'try'
PWC6199: Generated servlet error:
string:///index_jsp.java:33: 'try' without 'catch' or 'finally'
PWC6199: Generated servlet error:
string:///index_jsp.java:134: reached end of file while parsing
The code below+
+*>>>*+
<%--
Document : index
Created on : Mar 9, 2010, 3:26:07 PM
Author : Administrator
--%>
<%@ page language="java" import="java.sql.*" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% Class.forName("oracle.jdbc.OracleDriver"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Fetching Data From a Database</TITLE>
</HEAD>
<BODY>
<H1>Database Lookup</H1>
<FORM ACTION="index.jsp" METHOD="POST">
Please enter the ID of the publisher you want to find:
<BR>
<INPUT TYPE="TEXT" NAME="id">
<BR>
<INPUT TYPE="SUBMIT" value="Submit">
</FORM>
<H1>Fetching Data From a Database</H1>
<%
Connection connection = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:orcl","test","test");
Statement statement = connection.createStatement();
String id = request.getParameter("id");
ResultSet resultset =
statement.executeQuery("select * from tableName where id = '" id "'") ;
if(!resultset.next()) {
out.println("Sorry,could not find that publisher. Please <A HREF='tryAgain.html'>try again</A>.");
} else {
%>
</BODY>
</HTML>