       (let [^java.sql.Connection conn (if (not (blank? conn-jar))
                                         (connect-with-path! conn-data)
                                         (connect-with-auto! conn-data))]
-        (.setAutoCommit conn false)
-        {:conn conn})
+        (if (not= conn nil)
+          (do
+            (.setAutoCommit conn false)
+            {:conn conn})
+          {:conn nil
+           :msg "Connection failed"}))
       (catch java.security.PrivilegedActionException e {:conn nil
                                                         :msg (str e)
                                                         :desc (exception-to-stacktrace e)})

  [conn-data]
  (let [jar-paths (util/find-driver-jars)
        jar-urls (map (fn [p] (java.net.URL. "file" "" p)) jar-paths)]
    (connect-with-urls! conn-data jar-urls)))


(defn connect-with-auto!



(defn connect-with-urls!
  "Try to connect using URLClassLoader initialized with given url.

  Parameters:

  - conn-data - defines connection metadata,
  - urls - nonempty coll of urls.
  "
  [^clojure.lang.IPersistentMap conn-data urls]
  (assert (not= urls nil))
  (assert (> (count urls) 0))
  (let [conn-class (conn-data "class")
        conn-str (conn-data "jdbc-conn-str")
        url-class-loader (java.net.URLClassLoader. (into-array urls))
