You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Fa...@aventis.com on 2002/07/12 19:20:25 UTC
Apache Tomcat/4.0.3 Error loading driver: java.lang.ClassNotFound
Exception: oracle.jdbc.driver.OracleDriver
I have a problem in running a jsp from a standalone Tomcat web server. I
kept getting problems as "Error loading driver:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver". I have
set "/raid1/oracle817i/product/8.1.7i/jdbc/lib/classes12.zip" to the
classpath, and I have no problem in running a java version of this code on
the command line to connect to the database through jdbc. However, I can't
run the jsp code from the web. The Tomcat server was started after all the
environment parameters were set up. How do I configure the server.xml and
web.xml file in order for Tomcat and JDBC work together?
Here is my jsp code:
<html>
<head>
<title>
Get Qualifiers
</title>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<h1>The Qualifier is:</h1>
<table border="1" width="400">
<%
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
String driver="oracle.jdbc.driver.OracleDriver";
String dbURL="jdbc:oracle:thin:@pro.nlm.com:5555:TESTDB";
String login="xxxx";
String password="xxxx";
String sql = "select qualifiername from qualifier where qualifierid = 10";
try {
Class.forName(driver);
connection=DriverManager.getConnection(dbURL,login,password);
statement=connection.createStatement();
resultSet = statement.executeQuery(sql);
if (resultSet.next()) {
String qname = resultSet.getString("qualifiername");
%>
<tr><td>connected</td><td>qname</td></tr>
<%
}
} catch(ClassNotFoundException cnfe) {
System.err.println("Error loading driver: " + cnfe);
} catch(SQLException sqle) {
System.err.println("Error connection: " + sqle);
}
%>
</table>
</body>
</html>
Thanks!!
Fan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>