May I ask how do I specify the driver for postgresql? No suitable driver found for jdbc:<postgresql://127.0.0.1:25432/gis>
Am trying
(def db {:dbtype "postgresql" :port "25432" :dbname "gis"})
(def ds (jdbc/get-datasource db))
(jdbc/execute! ds ["select * from hex200 limit 1"])
you just have to add the right dependency to your deps:
[org.postgresql/postgresql "some version"]
Am following the getting-started but and understand there is com.h2database/h2 {:mvn/version "1.4.199"}
. May I ask what is/where do i find the equivalent for postgresql and where do i put it
this is in both my project.clj and my require in the file right?
you don't have you require it, no. it just has to be on your classpath
and yep, if you're using lein
plop that into your :dependencies
you can find versions here: https://search.maven.org/artifact/org.postgresql/postgresql]
okay will try! May I ask if there is a list of dependencies to their databases?
not that i'm aware of, though we only use postgres ¯\(ツ)/¯
most databases should have java driver lists somewhere in their documentation
I see I see!
Just wanted to know if i do ever use a different database - but am likely just using postgresql for postgis and pgrouting
Thanks! i got it working!
:catjam:
@zackteo The Getting Started guide for next.jdbc
has a link to https://github.com/seancorfield/next-jdbc/blob/develop/deps.edn#L10-L27 which is a list of DB drivers that next.jdbc
has been tested against. That’s on this page https://cljdoc.org/d/seancorfield/next.jdbc/1.1.646/doc/getting-started in the paragraph that says “In addition, you will need to add dependencies for the JDBC drivers you wish to use for whatever databases you are using. You can see the drivers and versions that next.jdbc is tested against in the project’s deps.edn file, but many other JDBC drivers for other databases should also work (e.g., Oracle, Red Shift).” The italicized phrase is the link to the list of drivers.
I always welcome suggestions on improving the docs to make stuff like this easier/more obvious…
I did read through that part and even went to the deps.edn
but it somehow wasn't immediately obvious then. When re-reading the documentation, however, it is very clear :thinking_face:
Maybe I just got distracted midway hmmmm, I was thinking the deps.edn
would be dependencies for next.jdbc, which in hindsight makes perfect sense, since you need those dependencies to run tests
I wonder if an example like "In addition, you will need to add dependencies for the JDBC drivers you wish to use for whatever databases you are using. For example org.postgresql/postgresql
for postgresql." would be good
’k… if you think there’s a clearer way to show it in the docs, I’m happy to update things. Perhaps even just listing a few popular databases and their drivers? Although versions change often…
Hah, yeah, we’re on the same page!
Sure, I can make that update…
I could do a quick pull request if that's better for you
was wondering if "You can see the drivers and versions" -> "You can see the list of drivers and versions" might make a difference. In my brain, I was looking for a list of drivers
maybe I was confused about the dependencies part because I saw org.postgresql.Driver
too - but that's probably just me veering off the getting started
documentation
https://github.com/seancorfield/next-jdbc/blob/develop/doc/getting-started.md
Looks good!