There are many similar questions but I am closing the connection in the finally block. I am testing so I am refreshing the same page often.
in the DAO ( which is called from the controller when the view is accessed)
try {
                con= DB.getConnection();
                st= connection.createStatement();
                rs = statement.executeQuery(MY_QUERY);
            while (rs.next()) {
                ...                 
                }               
         } catch (SQLException e ) {
             e.printStackTrace();    
        } finally {
             try { rs.close(); } catch (Exception e) { /* ignored */ }
             try { st.close(); } catch (Exception e) { /* ignored */ }
             try { conn.close(); } catch (Exception e) { /* ignored */ }
        }
in application.conf
 db.default.driver=org.postgresql.Driver
 db.default.url="jdbc:postgresql://hostname2/schema"
 db.default.user="myuser"
 db.default.password="mypass"
Inevitably after a few hours coding I hit the no more connections error. shouldn't the finally close the connection and return it to myuser's pool? Does hitting CTRL-D not close the connection?
Using: PostgreSQL, Java with Play2 framework, running with play run (testing/building stage)
UPDATE: still looking for a reason
 
     
    