连接数据库报错
java.sql.SQLException: The Network Adapter could not establish the connection
用sqlplus 连接数据库可以连上
java连接时报错。
用ip地址作连接,防火墙以关/
向高手请教
------解决方案--------------------
lz在 管理工具--> 服务 中启动OracleOraDb10g_home1TNSListener服务后再刷新看该服务是否还显示为“已启动”。
------解决方案--------------------
10g我没用过,9i2我把C:\oracle\ora92\network\admin目录下的listener.ora和tnsnames.ora文件中的HOST全部改为:HOST = 127.0.0.1 就好了,我以前遇见过这种情况。
# LISTENER.ORA Network Configuration File: C:\oracle\ora92\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = tfpc)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = tfpc)
)
)
**********************
# TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
TFPC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = tfpc)
)
)
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
------解决方案--------------------
lz这样:开始--> 运行--> cmd--> netstat -na
找找里面有没有如下一行:
TCP 127.0.0.1:1521 0.0.0.0:0 LISTENING