Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC Connection Exception

591923Aug 7 2007
Hi,
i was working on my project for the databas course... and in the lab we have got oracle 10g installed on one server and tomcat on another server.... the jdbc drivers have been installed on the tomcat machine and the classpath has been set... but still i couldnt figure out why the exception for the drivers....first i thought some problem with my code, then i downloaded this snippet and tried to work with it.... but then i ended up getting the same error...

Employees

ClassNotFoundException: oracle.jdbc.driver.OracleDriver

here is the code...

<!- Sample basic Jsp/Oracle ,http://www.exzilla.net/, Jan3,2000 -->
<%@ page import="java.sql.*" %>
<HTML>
<HEAD><TITLE>Simple JSP/Oracle Query Example</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<B>Employees</B>
<BR><BR>

<%
Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@turing.cs.lamar.edu:1521/dbturing",
"group2",
"group2");

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM authentication");

//Print start of table and column headers

out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>ID</TH><TH>StudentID</TH><TH>Password</TH>");

//Loop through results of query.

while(rs.next())

{
out.println("<TR>");
out.println(" <TD>" + rs.getString("StudentID") + "</TD>");
out.println(" <TD>" + rs.getString("Password") + "</TD>");
out.println("</TR>");
}

out.println("</TABLE>");

}
catch(SQLException e)
{

out.println("SQLException: " + e.getMessage() + "<BR>");
while((e = e.getNextException()) != null)
out.println(e.getMessage() + "<BR>");

}

catch(ClassNotFoundException e)

{
out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");
}
finally
{
//Clean up resources, close the connection.
if(conn != null)
{
try
{
conn.close();
}
catch (Exception ignored) {}
}
}

%>
</CENTER>
</BODY>
</HTML>


Here is the classpath
[dakuris@scooby ~]$ echo $CLASSPATH
/usr/java/odbc/ojdbc14.jar:/usr/java/Xtango:/usr/xerces-2_4_0/xercesImpl.jar:/usr/xerces-2_4_0/xmlParserAPIs.jar:/usr/local/apache-tomcat-6.0.13/webapps/mysql-connector-java-5.0.7-bin.jar:/usr/local/apache-tomcat-6.0.13/webapps/ojdbc14dms.jar:.


if i have posted this in a wrong forum , i apologise... if some one can help me with this... i would really appreciate their help..

Regards
Dakuri, Shashidhar M
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 4 2007
Added on Aug 7 2007
0 comments
1,840 views