Q: Cannot create connection pool with hikari-cp I cannot create connection pool using hikari-cp library in my application which uses Clojure code.
I tried below code:
(def ^:private connection-pool (atom nil))
(defn initialize! []
  (reset!
    connection-pool
    {:datasource (hikari/make-datasource (config/db-spec))}))

config/db-spec is fetching proper config parameters as I am able to connect to the postgresql using the parameters which i am using to make-datasource.
I am using [hikari-cp "1.6.1"]
and I am getting below error:
[INFO ] 2018-07-31 18:03:18,735 [main] com.zaxxer.hikari.HikariDataSource:<init>: db-pool - is starting.
[INFO ] 2018-07-31 18:03:48,845 [main] com.zaxxer.hikari.pool.HikariPool:shutdown: db-pool - is closing down.
Exception in thread "main" com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Exception during pool initialization: db-pool - Connection is not available, request timed out after 30009ms., compiling:<>
at com.zaxxer.hikari.pool.HikariPool.initializeConnections(HikariPool.java:526)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:136)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
    at hikari_cp.core$make_datasource.invokeStatic(core.clj:183)
    at hikari_cp.core$make_datasource.invoke(core.clj:180)


A: Here is an example repo for using Hikari and JDBC with an H2 local database for testing.  It uses the current version:  [hikari-cp "2.3.0"].  
Just clone the repo and run lein test:
~/expr/demo-jdbc > lein test

lein test _bootstrap

----------------------------------
   Clojure 1.9.0    Java 10.0.1
----------------------------------

lein test demo.core

lein test tst.demo.core

lein test tst.demo.jdbc

result-0 => 
({:lang "Clojure", :desc "ancients"}
 {:lang "Clojure", :desc "1.8"}
 {:lang "Clojure", :desc "1.9"})

lein test tst.demo.jdbc-pool

all tests finished

Ran 4 tests containing 10 assertions.
0 failures, 0 errors.

The relevant parts are:
(ns xyz
  (:require
    [clojure.java.jdbc :as jdbc]
    [hikari-cp.core :as pool]
    ))

(def datasource-options-sample {:auto-commit        true
                                :read-only          false
                                :connection-timeout 30000
                                :validation-timeout 5000
                                :idle-timeout       600000
                                :max-lifetime       1800000
                                :minimum-idle       10
                                :maximum-pool-size  10
                                :pool-name          "db-pool"
                                :adapter            "h2" ; "postgresql"
                                :username           "sa"
                                :password           ""
                                :database-name      "database"
                                :server-name        "localhost"
                                :port-number        5432
                                :register-mbeans    false})

(def datasource-options {:adapter  "h2"
                         :url      "jdbc:h2:mem:demo;DB_CLOSE_DELAY=-1"
                         :username "sa"
                         :password ""})

(def ^:dynamic db-conn nil)

(defn with-connection-pool
  "Creates and uses a connection for test function"
  [tst-fn]
  (let [datasource (pool/make-datasource datasource-options)]
    (binding [db-conn {:datasource datasource}]
      (tst-fn)
      (pool/close-datasource datasource)))) ; close the connection - also closes/destroys the in-memory database

(use-fixtures
  :once with-connection-pool) ; use the same db connection pool for all tests

