/** * Invokes a closure passing it a new Sql instance created from the given JDBC connection URL. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param c the Closure to call * @see #newInstance(String) * @throws SQLException if a database access error occurs */ 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, * properties and driver classname. The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, java.util.Properties, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, Properties properties, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, properties, driverClassName); 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 and properties. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @param c the Closure to call * @see #newInstance(String, java.util.Properties) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, Properties properties, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, properties); 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, user and password. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @param c the Closure to call * @see #newInstance(String, String, String) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, String user, String password, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, user, password); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, driverClassName); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, String, String, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, String user, String password, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, user, password, driverClassName); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param c the Closure to call * @see #newInstance(String) * @throws SQLException if a database access error occurs */ 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 map of arguments. * The created connection will be closed if required. * * @param args a Map contain further arguments * @param c the Closure to call * @see #newInstance(java.util.Map) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(Map<String, Object> args, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(args); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param c the Closure to call * @see #newInstance(String) * @throws SQLException if a database access error occurs */ 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 map of arguments. * The created connection will be closed if required. * * @param args a Map contain further arguments * @param c the Closure to call * @see #newInstance(java.util.Map) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(Map<String, Object> args, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(args); 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 and properties. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @param c the Closure to call * @see #newInstance(String, java.util.Properties) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, Properties properties, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, properties); 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, user and password. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @param c the Closure to call * @see #newInstance(String, String, String) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, String user, String password, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, user, password); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, driverClassName); 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, user and password. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @param c the Closure to call * @see #newInstance(String, String, String) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, String user, String password, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, user, password); 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. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, driverClassName); 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, * properties and driver classname. The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @param driverClassName the fully qualified class name of the driver class * @param c the Closure to call * @see #newInstance(String, java.util.Properties, String) * @throws SQLException if a database access error occurs * @throws ClassNotFoundException if the driver class cannot be found or loaded */ public static void withInstance(String url, Properties properties, String driverClassName, Closure c) throws SQLException, ClassNotFoundException { Sql sql = null; try { sql = newInstance(url, properties, driverClassName); 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 and properties. * The created connection will be closed if required. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @param c the Closure to call * @see #newInstance(String, java.util.Properties) * @throws SQLException if a database access error occurs */ public static void withInstance(String url, Properties properties, Closure c) throws SQLException { Sql sql = null; try { sql = newInstance(url, properties); c.call(sql); } finally { if (sql != null) sql.close(); } }