java.sql.SQLException: Io 异常: Connection reset
来源:互联网 发布:逆光源网络剧未删减版 编辑:程序博客网 时间:2024/05/01 15:58
当数据库连接池中的连接被创建而长时间不使用的情况下,该连接会自动回收并失效,但客户端并不知道,在进行数据库操作时仍然使用的是无效的数据库连接,这样,就导致客户端程序报“ java.sql.SQLException: Io 异常: Connection reset” 或“java.sql.SQLException 关闭的连接”异常。
在配置数据源后面加上
<property name="validationQuery" value="select * from dual"/>
配置后,客户端在使用一个无效的连接时会先对该连接进行测试,如果发现该连接已经无效,则重新从连接池获取有效数据库连接来使用。
在tomcat的context.xml里面设置数据源时候可参考:
<Resource auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@11.11.11.45:1521:orcl"
name="jdbc/login"
username="login"
password="login"
maxActive="15"
maxIdle="10"
maxWait="-1"
minIdle="2"
removeAbandonedTimeout="5"
testOnBorrow="true"
testWhileIdle="true"
testOnReturn="true"
removeAbandoned="true"
logAbandoned="true"
validationQuery="select 1 from dual"
/>
<Resource auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@11.11.11.44:1521:orcl"
name="jdbc/intraweb"
username="intraweb"
password="intraweb"
maxActive="15"
maxIdle="10"
maxWait="-1"
minIdle="2"
removeAbandonedTimeout="5"
testOnBorrow="true"
testWhileIdle="true"
testOnReturn="true"
removeAbandoned="true"
logAbandoned="true"
validationQuery="select 1 from dual"
/>
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException: Io 异常: Connection reset
- java.sql.SQLException:IO异常:Connection reset...........
- java.sql.SQLException: Io exception: Connection reset
- 异常java.sql.SQLException: Io exception:The Network Adapter could not establish connection
- java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection解决方案
- 关于java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
- java.sql.SQLException: Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=16986
- java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
- java.sql.SQLException: Io 异常: Software caused connection abort: socket write error
- java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
- (java.sql.SQLException: Io 异常: The Network Adapter could not establish the 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
- ubuntu下Chrome在ROOT下运行
- hdu 1005
- 搜狗公交发布的背后
- dojo--firefox console调试
- 命令行时,出现ImportError: No module named
- java.sql.SQLException: Io 异常: Connection reset
- Process Request shows status of 'INITIATED' or 'PROCESSING' but nolonger running
- hdu 1008
- DBCP的配置参数
- 单片机(不基于os)下如何实现简单的内存管理(malloc,realloc和free函数的重新实现)
- HTTP 返回码
- 创建流体
- Extjs中动态生成树
- 广告投放系统(openx)