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.

0 700 6

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

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
14 2929 7
New
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...
0 1500 3
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
0 1105 1
New
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
7 1151 10
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
0 1460 5
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...
0 1127 1
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
0 1160 10
New
dachristenson
@mfazio23 Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
0 2099 5
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
476 5728 111
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
193 4510 82
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
38 4062 19
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
177 8632 77
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
10 5256 6
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
91 5152 43
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
4 4891 0
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
43 3103 21
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
62 6351 19
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
27 2843 9
New

Sub Categories: