java中isclosed_java.sql.SQLException: Conntion is closed.解决方法

最近在一个java调用oracle存储过程的程序中,经行压力测试老报java.sql.SQLException: Conntion is closed,间歇中冶也有java.sql.SQLException: Conntion is closed。如果对java调用oracle存储过程不太清楚的可以查看http://tiantiankaixin.iteye.com/blog/770250,这里讲的比较清楚了。

就这个错误我查看了网上的各种资料发现了有着两种可能:

(1)

1 private static String sql = null;2 String rtn = null;3

4 @POST5 //无参数传入

6 public String RK_JSCX() throwsException {7

8 RK_JSCX_Response response = null;9 List list = null;10 Connection con = null;11 CallableStatement cs = null;12 ResultSet rs = null;13 try{14

15 //存储过程

16 sql = "{call RK_JSCX(?,?)}";17 con =ConnectionUtils.getInstance().getConnect();18

19 if(con.isClosed()) {20 throw new IllegalStateException("ERROR.THE CONNECTION ISCLOSED");21 }22

23 cs =con.prepareCall(sql);24

25 //传出参数

26 cs.registerOutParameter(1, oracl

你可能感兴趣的:(java中isclosed)