...

View Full Version : Oracle & JSP Connectivity



TheMafioso
07-08-2006, 06:37 PM
Hi Guys,

I need to develop network based inventory management system using JSP and Oracle.I've got Oracle XE installed on my system and Tomcat 5 server.

The problem is i'm unable to connect Oracle.
I'm using the following Javascript to insert record(123, xyz) in table having 2 columns as sno and name. My oracle XE server is at 192.168.1.2 and port 8081. The login, password and schema name is "abeer"


<%@ page import="java.lang.*" language="java"%>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>


<%

int sno=123;
String name="xyz";

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.2:8081:abeer","abeer","abeer");

Statement stmt=conn.createStatement();

int rowsAffected=stmt.executeUpdate("insert into SAMPLE values ('"+sno+"','"+name+"')");


stmt.close();
conn.close();
%>


I get the following error


HTTP Status 500 -

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

type Exception report

message

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

exception

org.apache.jasper.JasperException: oracle.jdbc.driver.OracleDriver
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.test1_jsp._jspService(test1_jsp.java:77)
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:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.apache.jsp.test1_jsp._jspService(test1_jsp.java:55)
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:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


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






I've set the enviorment variables as
CLASSPATH=F:\oraclexe\app\oracle\product\10.2.0\server\classes12.jar

JAVA_HOME = D:\jdk1.5.0_07


Can anybody tell me why is this error occouring ???

Best Regards,

jetbrains
07-09-2006, 04:46 AM
Make sure you put Oracle driver into classpath

TheMafioso
07-09-2006, 08:53 AM
^^classes12.jar ie the oracle drivers are already in classpath. Apart from that are there any other oracle drivers ??

hotpop
07-10-2006, 05:11 AM
Put classes12.jar into tomcat/common/lib directory.
Put tools.jar into tomcat/common/lib directory.

TheMafioso
07-10-2006, 06:13 PM
^^done that, dosen't help :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum