with-connection(clojure.contrib.sql)

Macro

Evaluates body in the context of a new connection to a database then closes the connection. db-spec is a map containing values for one of the following parameter sets:

DriverManager: :classname (required) a String, the jdbc driver class name :subprotocol (required) a String, the jdbc subprotocol :subname (required) a String, the jdbc subname (others) (optional) passed to the driver as properties.

DataSource: :datasource (required) a javax.sql.DataSource :username (optional) a String :password (optional) a String, required if :username is supplied

JNDI: :name (required) a String or javax.naming.Name :environment (optional) a java.util.Map

; clojure/contrib/sql.clj:34
(defmacro with-connection
  [db-spec & body]
  `(with-connection* ~db-spec (fn [] ~@body)))

Copyright (c) Rich Hickey. All rights reserved.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0, which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.