Interface DatabaseConnection

    • Method Detail

      • executeQuery

        void executeQuery​(String sql,
                          Object[] parameters,
                          ResultSetCallback callback)
                   throws SQLException
        Execute a query and process the result using a callback.
        Parameters:
        sql - the SQL
        parameters - The parameters, may be null for no parameters, may contain OutputParameter and Null objects, if an array is passed no element may be null.
        callback - the callback to pass the ResultSet to.
        Throws:
        SQLException - if an error occurs.
        See Also:
        for an example
      • executeQueryAutoClose

        ResultSet executeQueryAutoClose​(String sql,
                                        Object... parameters)
                                 throws SQLException
        Execute a query and return the result set, the result set will be automatically closed if the user does not do so. You may call close() on the result early.
        Parameters:
        sql - the SQL
        parameters - The parameters may contain OutputParameter and Null objects, if an array is passed no element may be null.
        Returns:
        the result set.
        Throws:
        SQLException - if an error occurs.
        See Also:
        for an example
      • executeUpdate

        int executeUpdate​(String sql,
                          Object... parameters)
                   throws SQLException
        Execute an update and return the number of rows updated.
        Parameters:
        sql - the SQL
        parameters - The parameters may contain OutputParameter and Null objects, if an array is passed no element may be null.
        Returns:
        the number of rows updated.
        Throws:
        SQLException - if an error occurs.
        See Also:
        for an example
      • getWrappedConnectionAutoClose

        Connection getWrappedConnectionAutoClose()
                                          throws SQLException
        Get the underlying connection. This is wrapped using dynamic proxies to ensure resources are closed correctly. This connection may be cast to Unwrap in order to be unwrapped. Note that unwrapping a connection is done at the customer's own risk and means that no support will be provided for resource management issues.
        Returns:
        the connection.
        Throws:
        SQLException - if an error occurs.
        See Also:
        for an example
      • getCloseOnReturn

        boolean getCloseOnReturn()
        Will the connection be physically closed, or returned to the pool?
        Returns:
        true, when the connection is physically closed and not returned to the pool, when the connection is closed. False, when the connection is returned to the pool, when the connection is closed.
      • setCloseOnReturn

        void setCloseOnReturn()
        Sets closeOnReturn, meaning that the connection is physically closed, rather than returned to the connection pool.