kostafey / ejc-sql

Emacs SQL client uses Clojure JDBC.
278 stars 29 forks source link

No suitable driver found for jdbc:postgresql://localhost:5432/db #177

Closed flashjames closed 1 year ago

flashjames commented 1 year ago

Messages buffer

Connection started...
clomacs-get-result: Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702).

No suitable driver found for jdbc:postgresql://localhost:5432/backendmedusa

ejc-config

(straight-use-package '(ejc-sql :type git :host github :repo "kostafey/ejc-sql"))

(straight-use-package '(flx-ido))
(straight-use-package '(flx))

(ejc-create-connection
 "PostgreSQL-db-connection"
 :classpath (concat "~/.m2/repository/postgresql/postgresql/9.3.1102.jdbc41/" "postgresql-9.3-1102.jdbc41.jar")
  :subprotocol "postgresql"
 :subname "//localhost:5432/backendmedusa"
 :user "medusajs"
 :password "password")

Install in terminal:

Info system

Lenbok commented 1 year ago

I'm also trying ejc-sql for the very first time, got the same error. I think there's a typo in the readme regarding this. The repo path should have [...]/9.3-1102.jdbc41/ not [...]/9.3.1102.jdbc41/.

Then I got a different error about unsupported authentication. I needed to update the posgresql driver:

mvn org.apache.maven.plugins:maven-dependency-plugin:get -Dartifact=org.postgresql:postgresql:42.6.0 -DrepoUrl=http://clojars.org/repo/

and in the ejc connection:

 :classpath (concat "~/.m2/repository/org.postgresql/postgresql/42.6.0/" "postgresql-42.6.0.jar")

(kill any existing nrepls and reconnect). Now I can query.

kostafey commented 1 year ago

@Lenbok, thank you, the README file updated. Please note, that README provides only the basic idea how to install and configure JDBC driver because it becomes outdated over time. So, the general recommendation is to search the most recent driver version first, check the path and other options.