Skip to content

Instantly share code, notes, and snippets.

Created July 26, 2012 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3183120 to your computer and use it in GitHub Desktop.
Save anonymous/3183120 to your computer and use it in GitHub Desktop.
=> (doc clojure.java.jdbc/with-connection)
-------------------------
clojure.java.jdbc/with-connection
([db-spec & body])
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:
Factory:
:factory (required) a function of one argument, a map of params
(others) (optional) passed to the factory function in a map
DriverManager:
:subprotocol (required) a String, the jdbc subprotocol
:subname (required) a String, the jdbc subname
:classname (optional) a String, the jdbc driver class name
(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
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment