jsp连接ORACLE9I失败,请前辈帮忙
开发环境:TOMCAT5.0.30+ORACLE9I+JDK1.4
IP:192.168.100.89
数据库的SID:myoracle
SQLPLUS启动正常,TOMCAT与JSP运行正常.
用网上常用的JDBC连接ORACLE的例子进行测试连接,代码如下:
<%@ page contentType= "text/html;charset=gb2312 "%>
<%@ page import= "java.sql.* "%>
<html>
<body>
<%Class.forName( "oracle.jdbc.driver.OracleDriver ").newInstance();
String url= "jdbc:oracle:thin:@china3ct:1521:myoracle ";
String user= "system ";
String password= "zong ";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql= "select * from scott.dept ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
<%=rs.getString(1)%> - <%=rs.getString(2)%> <br>
<%}%>
<%out.print( "数据库操作成功,恭喜你 ");%>
<%rs.close();
stmt.close();
conn.close();
%>
</body>
</html>
出现如下错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Io 异常: The Network Adapter could not establish the connection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
oracle.jdbc.driver.OracleConnection. <init> (OracleConnection.java:404)
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
java.sql.DriverManager.getConnection(DriverManager.java:512)
java.sq