1 5 package org.h2.util; 6 7 import java.sql.Connection ; 8 import java.sql.ResultSet ; 9 import java.sql.SQLException ; 10 import java.sql.Statement ; 11 12 public class JdbcUtils { 13 14 public static void closeSilently(Statement stat) { 15 if(stat != null) { 16 try { 17 stat.close(); 18 } catch(SQLException e) { 19 } 21 } 22 } 23 24 public static void closeSilently(Connection conn) { 25 if(conn != null) { 26 try { 27 conn.close(); 28 } catch(SQLException e) { 29 } 31 } 32 } 33 34 public static void closeSilently(ResultSet rs) { 35 if(rs != null) { 36 try { 37 rs.close(); 38 } catch(SQLException e) { 39 } 41 } 42 } 43 44 public static ResultSet getGeneratedKeys(Statement stat) throws SQLException { 45 ResultSet rs = null; 46 rs = stat.getGeneratedKeys(); 48 return rs; 50 } 51 52 } 53 | Popular Tags |