bmads_51

bmads_51

Web Development with Clojure, Third Edition - Appendix 4 (Database Access) p. 395

Dmitri Sotnikov @dmitri and Scot Brown @svmbrown

Hi all,
I’m working through the Appendix 4 (Database Access) starting on p. 395 and there are a number of discrepancies with what’s in the book vs. what actually will execute. So I will document here as I make my way through.

On p. 397,

(def ds (jdbc/get-datasource
{:subprotocol “postgresql”
:subname “//localhost/reporting
:user “admin”
:password “admin”}))

In the preceding example, we’ve defined a connection for an instance of the
PostgreSQL database by specifying the database type using the :dbtype key and a name using the :dbname key.

The above did not work for me and I got this error:

error {
:cause Unknown dbtype: , and :classname not provided.
:data {:subprotocol postgresql, :subname //localhost/reporting, :user admin, :password admin}
:via
[{:type clojure.lang.Compiler$CompilerException

Notice that :dbtype & :dbname are not in the hashmap (as the error message indicates and the sentence in the book itself indicates we should be using) so using this hashmap works (I also had to remove the “//local/” prefix in the dbname.

(def ds (jdbc/get-datasource
{:dbtype “postgresql”
:dbname “reporting”
:user “admin”
:password “admin”}))

After executing, I get:

[#:next.jdbc{:update-count 0}]

which is what the book says we should get.

First Post!

bmads_51

bmads_51

Dmitri Sotnikov @dmitri and Scot Brown @svmbrown

On p. 398, in the Selecting Records section,

db-examples.core=> (get-user “foo”)
nil

does not work because get-user requires 2 parameters. Hence, you need to invoke:

(get-user ds “foo”)
nil

Where Next?

Popular Pragmatic Bookshelf topics Top

jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
jgchristopher
“The ProductLive.Index template calls a helper function, live_component/3, that in turn calls on the modal component. ” Excerpt From: Br...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New

Other popular topics Top

AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
New

Sub Categories: