1

Oracle是IP: ps-server-dom

端口: 1521

Usado o adaptador HOSTNAME para resolver o apelido
Tentativa de contatar (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTO
COL=TCP)(HOST=192.168.0.101)(PORT=1521)))
OK (10 ms)

错误:

java.sql.SQLException: Exceção de E/S: The Network Adapter could not establish the connection

代码:

Class.forName("oracle.jdbc.OracleDriver").newInstance();;
    conn = DriverManager.getConnection("jdbc:oracle:thin:@ps-server-dom:1521:PSYS", "psyst", "psyst");
4

1 回答 1

0

检查 listener.ora,tnsnames.ora 有正确的设置。如果你想用 'ps-server-dom' 访问它,那么这些文件应该有这个特定的主机名而不是 IP 地址。

下面显示了这些文件对于 oracle xe 的可能设置。

tnsnames.ora

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ps-server-dom)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

监听器.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = ps-server-dom)(PORT = 1521))
    )
  )

注意:如果您在某个域中,则 HOST=ps-server-dom.yourdomain.com。这些文件位于oraclexe\app\oracle\product\<version>\server\network\ADMINWindows 中的“”下。

于 2013-10-29T16:48:33.420 回答