Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database conn. jsp tomcat Oracle9i thin driver

 
Vikramjit Singh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Am trying to make database connection using Oracle9i thin driver, what am doing is:
I put classes12.zip and classes12_dms.jar in the classpath and also added these libraries in netbeans library folder.

I make jsp page like this --------

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*, java.sql.*"%>
<!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=UTF-8">
<title>Testing Page</title>
</head>
<body>
<%
String url = "jdbc racle:thin:@SERVERNAME:1521 BNAME";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(url,"scott","tiger");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from person order by name");
%>
<h1>Testing Page</h1><hr>
<table border="1">
<tbody>
<tr>
<th>Name</th>
<th>Email</th>
</tr>
<% while(rs.next()) {%>
<tr>
<td><%= rs.getString(1)%></td>
<td><%= rs.getString(2)%></td>
</tr>
<%
}
rs.close();
stmt.close();
conn.close();
} catch(ClassNotFoundException CNFEx) {
out.println("<b>Error !</b><br>" + CNFEx.getMessage());
} catch(Exception Ex) {
out.println("<b>Error !</b><br>" + Ex.getMessage());
}
%>
</tbody>
</table>
</body>
</html>

when I run this page i got this error messages ----

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

root cause
java.lang.NoClassDefFoundError
oracle.jdbc.driver.OracleConnection.createDMSSensors(OracleConnection.java:506)
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:330)
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:485)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:337)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

any kind of help is appericiable.
thanks.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic