Fork me on GitHub
#sql
<
2019-08-06
>
seancorfield01:08:13

seancorfield/next.jdbc {:mvn/version "1.0.5"} is available -- plan's internal "mapified" result set now implements all of IPersistentMap so dissoc, cons, count, empty etc all work (although dissoc and cons will realize a full row as a hash map, just like assoc and seq did before).

seancorfield01:08:24

The docs around connection pooling have also been updated.

dpsutton02:08:35

(def sqlite {:classname   "org.sqlite.JDBC"
             :subprotocol "sqlite"
             :subname     "resources/db/component.db"})
I'm getting "No suitable driver found for <jdbc://127.0.0.1/> .." Am i missing something obvious? I've got org.xerial/sqlite-jdbc {:mvn/version "3.28.0"} in my project and the db is at resources/db/component.db

dpsutton02:08:05

i feel like i never know where to find an authoritative source for making the connection maps. would love to know where to look to figure this out

dpsutton02:08:10

using "jdbc:sqlite:resources/db/component.db" works correctly though

seancorfield03:08:43

{:dbtype "sqlite" :dbname "resources/db/component.db"}

seancorfield03:08:33

next.jdbc has dropped support for the :subprotocol / :subname form of db-spec because so many people get it wrong.

πŸ‘ 1
seancorfield03:08:56

clojure.java.jdbc and next.jdbc should both work with that :dbtype / :dbname version @dpsutton

dpsutton03:08:44

yes! that's what i was looking for. i remembered something like that for the older version but didn't see it for the new next.jdbc version.

seancorfield03:08:55

The next.jdbc getting started docs show the :dbtype / :dbname format and refer you to https://cljdoc.org/d/seancorfield/next.jdbc/1.0.5/api/next.jdbc#get-datasource for the full, mind-numbing detail on what is acceptable. Suggestions for improvements always welcome.

dpsutton03:08:18

wow. you just get tunnel vision some times πŸ™‚. I also found your specs that were very helpful

dpsutton03:08:32

s/describe and s/explain

seancorfield03:08:55

@dpsutton In java.jdbc, the docstring for get-connection also covers this in detail -- including saying that the subprotocol/subname format is "legacy" and the dbtype/dbname format is "preferred" by the way πŸ™‚

πŸ‘ 1
seancorfield03:08:42

I'm just kind of concerned about where folks are reading about java.jdbc and finding the bad/outdated advice about using that legacy format?

dpsutton03:08:59

i was just grabbing some connection maps from examples. i didn't know which drivers to use for sqlite so i found a project with it and its on the older version. and i thought i remembered the old connection map was still the same

seancorfield03:08:08

Cool re: specs. I'll note that in java.jdbc, instrumenting everything really slows things down. The specs in next.jdbc seem to be a lot leaner / faster.

seancorfield03:08:40

I'm always interested to hear of links to resources that have out of date information so I can go create issues, send PRs, or edit wikis!

seancorfield03:08:07

(that's a soul-crushing uphill battle but, hey... at least there should never be this problem with next.jdbc πŸ™‚ )

dpsutton04:08:13

This example was clojure-lsp. It’s on the older junction

seancorfield04:08:01

@dpsutton URL? clojure-lsp isn't turning up any java.jdbc examples for me.