Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Calling Oracle driver from a JSP page


Message #1 by "Joan Killeen" <Joan.Killeen@i...> on Mon, 4 Dec 2000 15:32:06 -0000
I use this code :

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

<%// Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());


    // syntax    <host>:<port>:<sid>
    Connection conn =DriverManager.getConnection
("jdbc:oracle:thin:@server:1521:orcl","username", "password");

    // Create a Statement
    Statement stmt = conn.createStatement ();

    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("querystring");

    // Iterate through the result and print the employee names
   %>


and i've added this line to the system classpath:
D:\orant\jdbc\lib\classes12.zip;

hope it helps!

Andrea

-----Original Message-----
From: Joan Killeen [mailto:Joan.Killeen@i...]
Sent: Monday, December 04, 2000 4:32 PM
To: Pro_JavaServer_Pages
Subject: [pro_jsp] Calling Oracle driver from a JSP page


I have Apache and Tomcat installed under Win2000 and can run simple JSP
pages.
But when I try to access an Oracle DB from a JSP page I get the following
exception:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<
javax.servlet.ServletException: Unable to load class
oracle.jdbc.driver.OracleDriver
	at org.apache.jasper.runtime.PageContextImpl.handlePageException
....
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<

I under the JSP code below.
Can anybody tell me the details of setting up the CLASSPATH in Tomcat so
that the driver class can be found. I have tried editing the
jakarta-tomcat/bin/tomcat.sh file but it didn't work.
On my machine the driver is installed under
D:\Oracle\Ora81\jdbc\lib\class12.zip.

What am I doing wrong??
Thanks for any help you can give.



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

<HTML>
<HEAD>
<TITLE>Simple DB Query</TITLE>
</HEAD>

<BODY>

<%
      Class.forName("oracle.jdbc.driver.OracleDriver");

      // Connect to the database
      // You can put a database name after the @ sign in the connection
URL.
      Connection conn 
        DriverManager.getConnection ("jdbc:oracle:oci8:@dgen", "jki",
"jki1");

      // Create a Statement
      Statement stmt = conn.createStatement ();
      // Select the ENAME column from the EMP table
      ResultSet m_rset = stmt.executeQuery ("select * from T_TRANSLATE");
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<

---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.


  Return to Index