aspose file tools*
The moose likes Tomcat and the fly likes JSP - Oracle connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JSP - Oracle connectivity" Watch "JSP - Oracle connectivity" New topic
Author

JSP - Oracle connectivity

Geethanadh Kondiparthi
Greenhorn

Joined: Jun 05, 2002
Posts: 6
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

Joined: Feb 28, 2002
Posts: 81
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 ]

SCJP2 (93%),SCWCD(88%)<br />-------------------------------<br />Never under estimate yr self, just represent yr profile in proper manner.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

for Tomcat 4.x, you must rename classes12.zip to classes12.jar
Dharmin Desai
Ranch Hand

Joined: Feb 28, 2002
Posts: 81
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

Joined: Jun 05, 2002
Posts: 6
Hi Dharmin,
we can solve this by unzip classes12.zip in your WEB-INF/classes directory.
Geethandh
alex reznik
Greenhorn

Joined: Jul 02, 2002
Posts: 27
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

Joined: Jul 02, 2002
Posts: 27
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

Joined: Mar 20, 2000
Posts: 26
Classes12.zip belongs in Tomcat-root/common/lib. Restart the server and it should be okay.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
 
 
subject: JSP - Oracle connectivity