public static void withInstance ( String url , Closure c ) throws SQLException { Sql sql = null ; try { sql = newInstance ( url ) ; c . call ( sql ) ; } finally { if ( sql != null ) sql . close ( ) ; } }
Invokes a closure passing it a new Sql instance created from the given JDBC connection URL . The created connection will be closed if required .