c3p0 You can't operate on a closed Connection解决办法

来源:互联网 发布:基于nodejs的cms 编辑:程序博客网 时间:2024/05/21 08:04

The information you posted is pretty clear. Your connection is closed.

Maybe you are not closing just the ResultSet, but instead close the entire connection?

Finally, ensure that the connection is open before you try to do anything with it. If it is not, get a new connection.


/** * 获取数据库连接 *  * @return */public static  Connection getConnection() {if (null == connection) {connection=newConnection();} try {if(connection.isClosed()){connection=dsWebgame.getConnection();}} catch (SQLException e) {e.printStackTrace();}return connection;}



原创粉丝点击