0

Hi I'm trying to connect using oracle10g with eclipse but its not able to locate the driver at all .

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.sql.*"	%>
<%
	
		String uname="system";
		String pwd="*****";
		String url = "jdbc:oracle:thin:@localhost:1521:XE";
		Connection con = null;
		Statement stmt = null;
		ResultSet rst = null;
        	
	try{
		con=DriverManager.getConnection(url, uname, pwd);
		stmt=con.createStatement();
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		
	}
	catch(Exception e){
		System.out.println(e.getMessage());
	}
	
	if(request.getParameter("action")!=null)
	{
	 	String bookname = request.getParameter("book_name");
	 	String author = request.getParameter("author");
	 	int id = Integer.parseInt(request.getParameter("id"));
	 	stmt.executeQuery("insert into book_details values('"+id+"','"+bookname+"','"+author+"')");
	}
		
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<center>BOOK LIST</center>
<br><br><br>
S.no
BookName
Author
<% 
while(rst.next())
{
%>
<%=rst.getInt("id")%>
<%=rst.getString("author")%>
<%=rst.getString("book_name")%>
<%
}
rst.close();
stmt.close();
con.close();
%>
</body>
</html>

For the above code its giving the following error:

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /dbcon.jsp at line 45

42: BookName
43: Author
44: <% 
45: while(rst.next())
46: {
47: %>
48: <%=rst.getInt("id")%>


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause 

java.lang.NullPointerException
	org.apache.jsp.dbcon_jsp._jspService(dbcon_jsp.java:99)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.14

Thanks

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by peter_budo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.