database connection


[ Follow Ups ] [ Post Followup ] [ Message Board ]

Posted by 'peter barry' on June 08, 2001 at 03:46:16 EST:

Hi all,
I am using Tomcat integrated into Apache and am writing JSP procedures to connect to an Oracle 8 Database. The message in tomcat is that the driver is not being loaded.
Code


<%@ page import="java.sql.*" %>

<%
Connection connection = null;
Statement statement = null;
ResultSet results = null;
EmployeeBean empl = new EmployeeBean();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:peter";
String query = "select * from person";
connection = DriverManager.getConnection(url, "system","managerr");
statement = connection.createStatement();
results = statement.executeQuery(query);
if (results.next()) {
empl.setempno(results.getString("emp_no"));
empl.setperson_Name(results.getString("person)_name"));
empl.setpwrd(results.getString("pwrd"));
empl.setphon_id(results.getString("phon_id"));
}
connection.close();
}
catch (ClassNotFoundException e) {
System.err.println("could not find bleedin driver");
}
catch (SQLException e) {
System.err.println("could not connect");
}
finally {
try { if (connection != null) connection.close(); }
catch (SQLException e) { }
}
%>

I do not know why the driver is not being found.

Is it my classpath is not correct??
Is there a need to configure the database to the driver thru
control panel/settings/32odbc etc etc??

Can anyone help me please as this is frustrating me no end.


TIA


Peter


Follow Ups:



Post a Followup


Name:
E-Mail:
Subject:

Message:


[ Follow Ups ] [ Post Followup ] [ Message Board ]