Hi.
I tried oracle database connection within
JSP but got class not found exception. I put the oracle
jdbc driver "classes111.zip" in the WEB-INF/lib, still got the same error. My codes as following, thanks in advance for any help/ideas.
<%@ page import="java.sql.*" %>
<%@ page import="db.cashTypeBean" %>
<jsp:useBean id="cashType" class="db.cashTypeBean">
<%
Connection connection = null;
Statement statement = null;
ResultSet results = null;
try{
System.out.println("before loading driver...");
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("complete loading driver...");
String url = "jdbc
racle:thin@hercules.fmd.cargill.com:1521:test";
String s = "IDV";
String query = "SELECT * FROM RDC.CSH_TYPS WHERE CSH_TYP_CD=" +s;
connection = DriverManager.getConnection(url, "dev_rdc", "dev_rdc");
statement = connection.createStatement();
results = statement.executeQuery(query);
if (results.next()){
cType.setCode(results.getString("CSH_TYP_CD"));
cType.setName(results.getString("LKUP_NM"));
}
connection.close();
}
catch (ClassNotFoundException e){
System.out.println("Fail to load database driver!");
}
finally{
try{ if(connection!=null) connection.close();}
catch (SQLException e) {}
}
%>