仍旧是这个问题:“java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver ”
在jb9下调试出现这种问题,
在单单tomcat下拋出“java.sql.SQLException: No suitable driver ”异常。
源代码如下:
jsp_oracle.jsp
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import= "java.sql.*" %>
<html>
<head>
<title>
jsp_access
</title>
</head>
<body bgcolor="#ffffff">
<br>
<%
try
{
Connection con;
Statement stmt;
ResultSet rs;
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:odbc:thin:192.168.0.1:1521:eblink";
con= DriverManager.getConnection(url,"system","eblink");
out.println("dfd");
stmt= con.createStatement();
rs = stmt.executeQuery("select * from MY_TABLE_1");
while(rs.next())
out.println("<tr><td>"+rs.getString(3)+"</td></tr><br>");
out.println("</table>");
}
catch(ClassNotFoundException cnfe)
{
out.println(cnfe);
}
catch(SQLException sqle)
{
out.println(sqle);
}
%>
</body>
</html>
我搜索以前的帖子,帖子上说的把oracle里的class12.jar,拷贝到tomcat\common\lib\下,但是还不行。仍是连不上oracle数据库