oracle 在 red hat 9 上不能连接的问题!!!!
我的JSP程序在WIN2K上的TOMCAT上连接ORACLE 817 成功,但是拿到RED HAT LINUX9上的TOMCAT 中就不能运行,TOMCAT的版本都是4.1.30。就是一个最简单的连接都不行。源文件如下:
<%@ page contentType="text/html;charset=gb2312" language="java" %>
<%@ page import="java.sql.*"%>
<%@ page import="oracle.jdbc.pool.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>录</title>
</head>
<body>
11111111111111111111111
<%
Connection conn; //数据库连接对象
Statement stmt; //SQL语句对象
ResultSet rs; //结果集对象
try {out.println("*********** a1 *********");
OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource();
out.println("*********** a2 *********");
String strCon = "jdbc:oracle:thin:@192.168.0.212:1521:oracl";
ocpds.setURL(strCon);
ocpds.setUser("jssys");
ocpds.setPassword("jssystem");
out.println("*********** a2222 *********");
conn= ocpds.getConnection();
// Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//
//设置数据库连接字符串
// String strCon = "jdbc:oracle:thin:@192.168.0.212:1521:oracl";
//连接数据库
// conn = DriverManager.getConnection(strCon,"jssys","jssystem");
out.println("*********** a3 *********");
//创建一个可以滚动的只读的SQL语句对象
stmt = conn.createStatement();
out.println("*********** 1 *********");
String sql="select * from gdcic_user where user_id='111'";
rs=stmt.executeQuery(sql);
while (rs.next()){
out.println("userid=111");
out.println("office= "+rs.getString("user_office"));
}
out.println("********** 2 **********");
/*
rs.close;
stmt.close;
conn.close;*/
}
catch (SQLException e){
out.println("********** 3 **********");
out.println(e.getMessage());
e.printStackTrace();
}
catch (Exception ex){
out.println("********** 4 **********");
ex.printStackTrace();
}
%>
22222222222222222222222222222
</body>
</html>
16:39:24.659 ERROR [http80-Processor4] - Io 异常: The Network Adapter could not establish the connection
16:39:24.664 ERROR [http80-Processor4] - Cannot open connection
java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection ...........
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
...........
... 50 more