Skip to content
Snippets Groups Projects
Unverified Commit 0d4b3077 authored by Cal Herries's avatar Cal Herries Committed by GitHub
Browse files

Add comments about setReadOnly (#28358)

parent 1faf115b
No related branches found
No related tags found
No related merge requests found
......@@ -396,6 +396,8 @@
;; steps that are in the default impl
(let [conn (.getConnection (sql-jdbc.execute/datasource-with-diagnostic-info! driver database))]
(try
;; in H2, setting readOnly to true doesn't prevent writes
;; see https://github.com/h2database/h2database/issues/1163
(doto conn
(.setReadOnly true))
(catch Throwable e
......
......@@ -199,6 +199,9 @@
(set-best-transaction-level! driver conn)
(set-time-zone-if-supported! driver conn timezone-id)
(try
;; Setting the connection to read-only does not prevent writes on some databases, and is meant
;; to be a hint to the driver to enable database optimizations
;; See https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#setReadOnly-boolean-
(.setReadOnly conn true)
(catch Throwable e
(log/debug e (trs "Error setting connection to read-only"))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment