This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-10
Channels
- # announcements (2)
- # asami (2)
- # babashka (29)
- # beginners (115)
- # cider (5)
- # clara (9)
- # cljdoc (14)
- # cljs-dev (1)
- # cljsrn (18)
- # clojars (3)
- # clojure (73)
- # clojure-australia (7)
- # clojure-europe (74)
- # clojure-nl (3)
- # clojure-norway (8)
- # clojure-spec (3)
- # clojure-uk (36)
- # clojured (1)
- # clojurescript (15)
- # conjure (18)
- # datomic (6)
- # deps-new (11)
- # depstar (7)
- # fulcro (2)
- # instaparse (1)
- # jobs (9)
- # nrepl (8)
- # off-topic (21)
- # pathom (5)
- # polylith (42)
- # proletarian (1)
- # rdf (10)
- # re-frame (2)
- # react (1)
- # reagent (20)
- # releases (3)
- # remote-jobs (4)
- # rum (9)
- # shadow-cljs (79)
- # sql (11)
- # tools-deps (64)
- # vim (3)
- # xtdb (26)
i'm using next.jdbc
with hikari and postgres and i'm having what looks like some timezone related problems - is there any way to set the connection timezone for connections gotten via the pool ? HikariConfig.setConnectionInitSql
seems ideal, but i'm not even creating a HikariConfig
object, just (connection/->pool HikariDataSource db-spec)
given up, just forced the JVM to UTC, which matches all our production stuff anyway
See https://github.com/seancorfield/next-jdbc/issues/138 — that’s why jdbc-url
got added (but there’s a bug affecting SQL Server usage right now — already fixed on develop but not released).
ah, ok, that makes sense
HikariCP has some weird blind spots. Like: using username
instead of user
— even though all the JDBC drivers use user
😐
(and c3p0 uses user
)
👍 thanks @U04V70XH6
@U0524B4UW for Postgres you can always just .execute
SET SESSION TIMEZONE TO 'US/Pacific';
You could wrap the DataSource
you pass to Hikari and have it do that in getConnection
when it creates new connections to add to the poole.g. something like
(defn wrapped-data-source ^javax.sql.DataSource [^javax.sql.DataSource original-data-source]
(reify javax.sql.DataSource
(getConnection [_]
(let [conn (.getConnection original-data-source)]
(try
(with-open [stmt (.createStatement conn)]
(.executeUpdate stmt "SET SESSION TIME ZONE 'US/Pacific';"))
(catch Throwable e
(.close conn)
(throw e)))
conn))))
good idea, thanks @U42REFCKA