日期:2014-05-18  浏览次数:20578 次

在servlet的Init中连接数据库,同时保存Connection 和Statement变量为了将来使用,但是一段时间不使用该servlet后,就连接不上数据库了?
在servlet的Init中连接数据库,同时保存Connection   和Statement变量为了将来使用,但是一段时间不使用该servlet后,就连接不上数据库了?报的错误如下:
java.sql.SQLException:   No   operations   allowed   after   statement   closed.
请各位指点一下

------解决方案--------------------
because of following cases:
1)java garbage
2)Threadsafe

WS Container releasethe instance of connection automatically.