Here you can find the source of rollbackAndClose(Connection con)
public static void rollbackAndClose(Connection con) throws SQLException
//package com.java2s; /*//from w w w .j ava2 s . c o m * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ import java.sql.Connection; import java.sql.SQLException; public class Main { public static void rollbackAndClose(Connection con) throws SQLException { if (con != null) { if (!con.getAutoCommit()) { con.rollback(); } con.close(); } } public static void close(Connection con) throws SQLException { if (con != null && !con.isClosed()) { con.close(); } } }