This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-29
Channels
- # babashka (30)
- # beginners (207)
- # biff (3)
- # calva (10)
- # cljs-dev (3)
- # clojure (34)
- # clojure-austin (3)
- # clojure-bay-area (1)
- # clojure-dev (3)
- # clojure-europe (31)
- # clojure-nl (1)
- # clojure-norway (37)
- # clojure-uk (8)
- # community-development (3)
- # core-async (4)
- # data-science (1)
- # dev-tooling (2)
- # emacs (4)
- # etaoin (12)
- # fulcro (7)
- # gratitude (1)
- # hyperfiddle (7)
- # jobs-discuss (191)
- # lsp (15)
- # malli (1)
- # other-languages (11)
- # overtone (1)
- # pathom (3)
- # pedestal (1)
- # polylith (21)
- # releases (1)
- # squint (5)
- # yamlscript (5)
`pod.babashka.postgresql` without SSL
Is there a way to connect to a PostgreSQL host without using SSL?
according to https://community.fly.io/t/can-not-connect-to-postgres-sql-ssl-handshake/12093 http://Fly.io seems to not support SSL
Can you try this using normal next.jdbc on the JVM? If you can get it to work there, then I would try it again with the pod. I think it should work the same
does pod.babashka.postgresql
support JDBC connection strings?
it's using next.jdbc under the hood so it's best to try that directly first when running into issues and only after that see if it's a pod-specific issue
this might be it? https://github.com/seancorfield/next-jdbc/blob/f03b1ba3168168d1cad2580a42fcf4b604310c49/doc/getting-started.md?plain=1#L531
Thanks, I’ll try that first
It did not seem to work 😞
Type: clojure.lang.ExceptionInfo
Message: SSL error: Remote host terminated the handshake
Data: {:type "class org.postgresql.util.PSQLException"}
Location: pnn/db.clj:19:8
the relevant part looks like this:
(ns pnn.db
(:refer-clojure :exclude [get])
(:require
[honey.sql :as hsql]
[pod.babashka.postgresql :as pg]))
(def db
{:dbtype "postgresql"
:host (or (System/getenv "DB_HOST") "localhost")
:dbname (or (System/getenv "DB_NAME") "pnn")
:user (or (System/getenv "DB_USER") (System/getenv "USER"))
:password (System/getenv "DB_PASS")
:port (parse-long (or (System/getenv "DB_PORT") "5432"))
:useSSL (not (System/getenv "DB_NOSSL"))})
(defn get [url]
(->> {:select [:url :info] :from [:notifications] :where [:= :url url]}
hsql/format
(pg/execute-one! db)))
sure, I can try
I think you can also use a direct JDBC url instead of the map. Not sure why this wouldn't work though
I’ll try that as the next option
same error with explicit false
:
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: SSL error: Remote host terminated the handshake
Data: {:type "class org.postgresql.util.PSQLException"}
Location: pnn/db.clj:19:8
----- Context ------------------------------------------------------------------
15:
16: (defn get [url]
17: (->> {:select [:url :info] :from [:notifications] :where [:= :url url]}
18: hsql/format
19: (pg/execute-one! db)))
^--- SSL error: Remote host terminated the handshake
I feel like I am trying to catch a red herring
I’ll try to verify if the DB is configured correctly
I’ve checked the connection settings with a simple psql
Docker image:
FROM postgres:16.2
CMD psql -a -c "SELECT 1;" $DATABASE_URL
This works
&ssl=false&sslmode=disable
this worked