Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created July 9, 2010 19:32
Show Gist options
  • Save swannodette/469926 to your computer and use it in GitHub Desktop.
Save swannodette/469926 to your computer and use it in GitHub Desktop.
(ns second-post.mysql
(:use aleph)
(:require [clojure.contrib.sql :as sql]))
(def db {:classname "com.mysql.jdbc.Driver"
:subprotocol "mysql"
:subname "//localhost:3306/dummy"
:user "root"
:password ""})
(defn insert-foo [val]
(sql/insert-values :foo [:bar] [val]))
(defn save [request]
(future
(sql/with-connection db (insert-foo "test"))
(respond! request
{:status 200
:headers {"Content-Type" "text/html"}
:body "Saved!"})))
(run-aleph save {:port 8080})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment