diff --git a/src/metabase/db/env.clj b/src/metabase/db/env.clj
index efbd80af5a4ac3ed76eb4dc01e377dec45c11acf..fb3cc1f7f0ef2e09d64d14c2980917f7c84124c0 100644
--- a/src/metabase/db/env.clj
+++ b/src/metabase/db/env.clj
@@ -50,8 +50,16 @@
      (let [db-file-name (config/config-str :mb-db-file)]
        (get-db-file db-file-name)))))
 
+(defn- format-connection-uri
+  "Prepends \"jdbc:\" to the connection-uri string if needed."
+  [connection-uri]
+  (if-let [uri connection-uri]
+    (if (re-find #"^jdbc:" uri)
+      uri
+      (str "jdbc:" uri))))
+
 (def ^:private connection-string
-  (delay (config/config-str :mb-db-connection-uri)))
+  (delay (format-connection-uri (config/config-str :mb-db-connection-uri))))
 
 (defn- connection-string->db-type [s]
   (when s
diff --git a/test/metabase/db/env_test.clj b/test/metabase/db/env_test.clj
index 6f9312e8d6123bd3a8ba6d96840c4d43c8af6f93..4561abf54cdc32019b761e5c85d7d146e81ce049 100644
--- a/test/metabase/db/env_test.clj
+++ b/test/metabase/db/env_test.clj
@@ -20,3 +20,11 @@
          clojure.lang.ExceptionInfo
          #"Unsupported application database type: \"sqlserver\""
          (#'mdb.env/connection-string->db-type "jdbc:sqlserver://bad")))))
+
+(deftest format-connection-uri-test
+  (let [conn-uri "postgresql://localhost:metabase?username=johndoe"
+        jdbc-conn-uri (str "jdbc:" conn-uri)]
+    (doseq [[input expected] [[conn-uri jdbc-conn-uri]
+                              [jdbc-conn-uri jdbc-conn-uri]
+                              [nil nil]]]
+      (is (= expected (#'mdb.env/format-connection-uri input))))))