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

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;
	}



你可能感兴趣的:(java,web开发)