Trying to use Heroku and Postgresql

920 views
Skip to first unread message

Zeynel

unread,
Oct 5, 2013, 4:54:09 PM10/5/13
to clo...@googlegroups.com
I am going through this Heroku tutorial https://devcenter.heroku.com/articles/clojure-web-application. I am getting the following error when I try to create a table in the local Postgresql database

user=>    (sql/with-connection (System/getenv "DATABASE_URL") 
          (sql/create-table :testing [:data :text]))


IllegalArgumentException db-spec null is missing a required parameter  

clojure.java.jdbc/get-connection (jdbc.clj:192)

What am I doing wrong? 

Zeynel

unread,
Oct 5, 2013, 7:26:18 PM10/5/13
to clo...@googlegroups.com
I figured that I need to keep the command window where I initialized the database open. What I thought was hung autovacuum launcher, it was actually the LOG. So in another cmd window I tried to created the database "shouter" but I get databse creation failed error. What am I doing wrong?


c:\>cd users/a/clojure/shouter

c:\Users\a\CLOJURE\shouter>createdb shouter
createdb: database creation failed: ERROR:  database "shouter"

Zeynel

unread,
Oct 5, 2013, 7:40:43 PM10/5/13
to clo...@googlegroups.com
It seems that the it did not create the database because it already existed! But now I am having a problem with the next command to export the database to the shell (as explained in the tutorial):

c:\Users\a\CLOJURE\shouter>export DATABASE_URL=postgresql://localhost:5432/shout
er
'export' is not recognized as an internal or external command,
operable program or batch file.

Why is this not recognizing "export"?

Bruce Adams

unread,
Oct 5, 2013, 5:13:53 PM10/5/13
to clo...@googlegroups.com
(System/getenv "DATABASE_URL") is returning nil. This will happen when the system environment variable DATABASE_URL is not defined.
 
- Bruce
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
For more options, visit this group at
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
 

Zeynel

unread,
Oct 5, 2013, 8:18:58 PM10/5/13
to clo...@googlegroups.com
Thanks. I found this article https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java and I tried 

c:\Users\a\CLOJURE\shouter\src>heroku config
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app
 APP.

I thought the "shouter" was the app. Can you direct me in the right direction about how to proceed? 

Zeynel

unread,
Oct 5, 2013, 9:01:25 PM10/5/13
to clo...@googlegroups.com
In the tutorial they add DATABASE_URL while deploying, at the last step: https://devcenter.heroku.com/articles/clojure-web-application#deploy

with this command:

$ heroku addons:add heroku-postgresql:dev
-----> Adding heroku-postgresql:dev to stormy-fog-408... done, v2 (free)

I don't understand what's going on.

Zeynel

unread,
Oct 6, 2013, 1:23:20 PM10/6/13
to clo...@googlegroups.com
Yes, it turned out that 'export' is for unix, I had to use 'set' and it worked. This was suggested by juan.facorro at SO: http://stackoverflow.com/questions/19204548/how-do-you-connect-to-local-postgresql-in-heroku#comment28425326_19204548


On Saturday, October 5, 2013 5:13:53 PM UTC-4, Bruce Adams wrote:
Reply all
Reply to author
Forward
0 new messages