Class JdbcUtils


  • public class JdbcUtils
    extends Object
    A set of static helper methods for managing JDBC API objects.

    Note: Some parts of this class were copied from the Spring Framework and then modified. They were copied here to prevent Spring dependencies in the Shiro core API. The original license conditions (Apache 2.0) have been maintained.

    Since:
    0.2
    • Method Detail

      • closeConnection

        public static void closeConnection​(Connection connection)
        Close the given JDBC Connection and ignore any thrown exception. This is useful for typical finally blocks in manual JDBC code.
        Parameters:
        connection - the JDBC Connection to close (may be null)
      • closeStatement

        public static void closeStatement​(Statement statement)
        Close the given JDBC Statement and ignore any thrown exception. This is useful for typical finally blocks in manual JDBC code.
        Parameters:
        statement - the JDBC Statement to close (may be null)
      • closeResultSet

        public static void closeResultSet​(ResultSet rs)
        Close the given JDBC ResultSet and ignore any thrown exception. This is useful for typical finally blocks in manual JDBC code.
        Parameters:
        rs - the JDBC ResultSet to close (may be null)