Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Oracle & JSP Connectivity

    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"
    Code:
    <%@ 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
    Code:
    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,
    Last edited by TheMafioso; 07-08-2006 at 08:37 PM.

  • #2
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Make sure you put Oracle driver into classpath

  • #3
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ^^classes12.jar ie the oracle drivers are already in classpath. Apart from that are there any other oracle drivers ??

  • #4
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Put classes12.jar into tomcat/common/lib directory.
    Put tools.jar into tomcat/common/lib directory.

  • #5
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ^^done that, dosen't help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •