Skip to content
Snippets Groups Projects
Commit 62651f2b authored by Ryan Senior's avatar Ryan Senior
Browse files

Add the OpneSourceSubProtocolOverride flag to PG and Redshift [ci drivers]

Redshift JDBC connection URLs can be writtend with the postgresql
subprotocol or the redshift protocol. This can cause problems as the
DriverManager (depending on how the classes have been loaded) will be
the first matching driver for a subprotocol. We could get the Redshift
driver when we were intending to get the PostgreSQL driver. Adding
this flag will ensure that we don't inadvertantly get the Redshift
driver when we intended to get PostgreSQL driver.
parent 276e3bb6
Branches
Tags
No related merge requests found
......@@ -23,7 +23,7 @@
:as opts}]
(merge {:classname "org.postgresql.Driver" ; must be in classpath
:subprotocol "postgresql"
:subname (str "//" host ":" port "/" db)}
:subname (str "//" host ":" port "/" db "?OpenSourceSubProtocolOverride=true")}
(dissoc opts :host :port :db)))
(defn mysql
......@@ -47,6 +47,6 @@
:as opts}]
(merge {:classname "com.amazon.redshift.jdbc.Driver" ; must be in classpath
:subprotocol "redshift"
:subname (str "//" host ":" port "/" db)
:subname (str "//" host ":" port "/" db "?OpenSourceSubProtocolOverride=false")
:ssl true}
(dissoc opts :host :port :db)))
......@@ -33,7 +33,7 @@
{:user "camsaul"
:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost:5432/bird_sightings"
:subname "//localhost:5432/bird_sightings?OpenSourceSubProtocolOverride=true"
:sslmode "disable"}
(sql/connection-details->spec pg-driver {:ssl false
:host "localhost"
......@@ -49,7 +49,7 @@
:subprotocol "postgresql"
:user "camsaul"
:sslfactory "org.postgresql.ssl.NonValidatingFactory"
:subname "//localhost:5432/bird_sightings"}
:subname "//localhost:5432/bird_sightings?OpenSourceSubProtocolOverride=true"}
(sql/connection-details->spec pg-driver {:ssl true
:host "localhost"
:port 5432
......@@ -268,7 +268,7 @@
;; make sure connection details w/ extra params work as expected
(expect
"//localhost:5432/cool?prepareThreshold=0"
"//localhost:5432/cool?OpenSourceSubProtocolOverride=true&prepareThreshold=0"
(:subname (sql/connection-details->spec pg-driver {:host "localhost"
:port "5432"
:dbname "cool"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment