java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
环境参数:
1、Spring配置
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@127.0.0.1:1521:test">
</property>
<property name="username" value="test"></property>
<property name="password" value="test"></property>
</bean>
2、Oracle初次安装,为默认参数:
其中listener.ora:
# listener.ora Network Configuration File: E:/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
3、解决办法
Oracle服务中的TNSListener没有启动 ------------->到服务中启动即可
URL不能解析---------->
1) 在Oralce菜单Net Configuration Assistant-->监听程序配置--->重新配置 以下都是默认下一步.该步骤是为了重新配置监听程序
2)在Oralce菜单Net Manager-->本地-->监听程序-->LISTENER--添加监听位置(例如:localhost)和端口(例如:1521)