Fork me on GitHub
#sql
<
2023-02-21
>
Lukas18:02:10

Hey guys, I' trying to connect to a db, but I'm getting a java.sql.SQLInvalidAuthorizationSpecException I have a connection to this db via Datagrip but I can't figure out what I'm missing for next.jdbc to etablish the connectio. This is my code:

(def db
 {:dbtype "mariadb"
  :dbname "te***te"
  :host "*****"
  :user "lukas.o*******r"
  :password "*************"
  :port 4002
  :enabledTLSProtocols "TLSv1,TLSv1.1,TLSv1.2,TLSv1.3" ;; also set in datagrip
  })

(def ds (jdbc/get-datasource db))

(jdbc/execute! ds ["select * from customer where Name like '%lukas%';"])

Lukas19:02:13

this is my config in datagrip

Lukas19:02:41

any help is greatly appreciated

dharrigan19:02:22

Perhaps a long shot, but I notice that your database in datagrip is telemate (8 characters), but your c&p to here for dbname is te***te which I assume is also telemate, yet it's only 7 characters. Perhaps just a typo in your c&p, right?

seancorfield19:02:46

Just to check: you're running the Clojure code on the same machinery that you are successfully running DataGrip to connect?

seancorfield20:02:00

It's possible you may need to add :useSSL true to your db hash map (different drivers default to SSL vs non-SSL). You may also need :trustServerCertificate true but only add that if you need it as well since it reduces security.

Lukas21:02:55

Thanks a lot :useSSL true did it

2
Lukas21:02:19

but I get this error now

Caused by sun.security.provider.certpath.SunCertPathBuilderException
   unable to find valid certification path to requested target

Lukas21:02:56

:thinking_face:

Lukas21:02:34

:trustServerCertificate true
i thopught I had tried it

Lukas21:02:43

needed to reevaluate the var

Lukas21:02:51

thank you so much

2
seancorfield21:02:11

Sometimes the stacktrace provides a Cause which offers more detail about why you get InvalidAuthorization (but whatever editor you're using hid that information).

Lukas21:02:08

I use emacs 😬

seancorfield21:02:30

CIDER trying to be... "helpful"... 😕