1 10 11 package org.mule.providers.jdbc; 12 13 import java.sql.Connection ; 14 import java.sql.SQLException ; 15 16 19 public abstract class JdbcUtils 20 { 21 22 public static void close(Connection con) throws SQLException 23 { 24 if (con != null && !con.isClosed()) 25 { 26 con.close(); 27 } 28 } 29 30 public static void commitAndClose(Connection con) throws SQLException 31 { 32 if (con != null) 33 { 34 if (con.getAutoCommit() == false) 35 { 36 con.commit(); 37 } 38 con.close(); 39 } 40 } 41 42 public static void rollbackAndClose(Connection con) throws SQLException 43 { 44 if (con != null) 45 { 46 if (con.getAutoCommit() == false) 47 { 48 con.rollback(); 49 } 50 con.close(); 51 } 52 } 53 54 } 55 | Popular Tags |