今天在部属系统时,JDBC连接数据库报出:java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(ERR=12518)(VSNNUM=150999297)(ERROR_STACK=(ERROR=(CODE=12518)(EMFI=4))(ERROR=(CODE=12571)(EMFI=4))))的异常。
怀疑是数据库监听器问题,监听器路径如下:$ORACLE_HOME/network/admin/目录下的listener.ora文件。
原文件如下:
# LISTENER.ORA Network Configuration File: E:/oracle/ora90/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 = webserver)(PORT = 1521)) ) ) )
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = E:/oracle/ora90) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = zzjinhui) (ORACLE_HOME = E:/oracle/ora90) (SID_NAME = ZZJINHUI) ) )
修改为(增加DIRECT_HANDOFF_TTC_LISTENER = OFF):
# LISTENER.ORA Network Configuration File: E:/oracle/ora90/network/admin/listener.ora # Generated by Oracle configuration tools. DIRECT_HANDOFF_TTC_LISTENER = OFF LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = webserver)(PORT = 1521)) ) ) )
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = E:/oracle/ora90) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = zzjinhui) (ORACLE_HOME = E:/oracle/ora90) (SID_NAME = ZZJINHUI) ) )
保存。重起监听器,问题解决。另外。查看基本信息的语句是:select * from v$instance