This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JSP - Oracle connectivity

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,
After installing and configuring the Tomcat 4 I am able to run JSP and Servlats. But I am unable to connect to Oracle database (oracle 8i) using thin driver.
Sample code is :
<html>
<head><title>Test JSP-JDBC</title></head><body>
<%@ page language="java"%>
<%@ page import="java.sql.*"%>
<%@ page import="oracle.jdbc.driver.OracleDriver" %>
<%
try
{
DriverManager.registerDriver(new OracleDriver());
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@myserver:1521:orcl","scott","tiger");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from emp");
while(rs.next())
{
out.println(rs.getString("ename")+"<br>");
}
}
catch (Exception e)
{
out.println(e);
}
%>
</body></html>
and the error msg is:
type: Exception report
message: Internal Server Error
description: The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception :
org.apache.jasper.JasperException: Unable to compile class for JSP
C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\second$jsp.java:4: Class oracle.jdbc.driver.OracleDriver not found in import.
import oracle.jdbc.driver.OracleDriver;
^
1 error
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
Please help me in solving this.
thanks in advance
Geethanadh
[Turned off smileys for so the JDBC connection string is displayed properly]
[ August 12, 2002: Message edited by: Bodie Minster ]
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I m also facing same problem.
Basically this, Oracle Thin driver resides at classes12.zip file, which i hv also set at my classpath varible but the same error encountered "oracle.jdbc.driver.OracleDriver -class not found "
If anybody has solution , please reply !
Thanks in advanced !
Dharmin
[ July 31, 2002: Message edited by: Dharmin ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for Tomcat 4.x, you must rename classes12.zip to classes12.jar
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry mike , i hv tried : I hv copied classes12.zip and rename it to classes12.jar,
Put that jar to classpath variable,And remove classes12.zip from classpath !
My other program can find oracle.jdbc.driver.OracleDriver from classes12.jar but Tomcat4.0.3 is unable to find the class.
The problem has not solved !
(Is tomcat taking files from temp - folder ??)
If i m doing mistake any where else , please tell me.
Thanks,
Dharmin
 
Geethanadh Kondiparthi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dharmin,
we can solve this by unzip classes12.zip in your WEB-INF/classes directory.
Geethandh
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the connection string is wrong, Oracle 8i uses different syntax:
for thin driver it will be
jdbc racle:thin:user/password@database :p ort:sid
hope this helps
alex
[turned off smileys so the connection string is displayed properly]
[ August 12, 2002: Message edited by: Bodie Minster ]
 
alex reznik
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jdbc racle:thin:user/password@database:1521:sid
[turned off smileys so the connection string is displayed properly]
[ August 12, 2002: Message edited by: Bodie Minster ]
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Classes12.zip belongs in Tomcat-root/common/lib. Restart the server and it should be okay.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Geethanadh K, Dharmin, and pilania:
The user names that you have chosen are not in keeping with the official Java Ranch naming policy. Please choose names that comply.
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic