Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP - Oracle connectivity

 
Geethanadh Kondiparthi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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("jdbcracle:thin:@myserver:1521rcl","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 ]
 
Dharmin Desai
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Hi Dharmin,
we can solve this by unzip classes12.zip in your WEB-INF/classes directory.
Geethandh
 
alex reznik
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
pilania
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes12.zip belongs in Tomcat-root/common/lib. Restart the server and it should be okay.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic