title: Heroku POSTGRESQL - "Too many connections for role" error
body: <p>I've set up a connection from localhost to the Dev database on Heroku (as described in: <a href="https://stackoverflow.com/questions/12195568/errors-in-evolutions-on-heroku/12196800#12196800">Errors in evolutions on Heroku</a>) and I am receving the following error after trying to apply evolutions a couple of times:</p>
  
  <pre><code>SQLException: Unable to open a test connection to the given database. JDBC url = [URL], username = null. Terminating connection pool. 
  Original Exception: org.postgresql.util.PSQLException: FATAL: too many connections for role "ntnkypawxazhwo"
      at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:469) 
      at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:110) 
      at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) 
      at org.postgresql.jdbc2.AbstractJdbc2Connection.&lt;init&gt;(AbstractJdbc2Connection.java:123) 
      at org.postgresql.jdbc3.AbstractJdbc3Connection.&lt;init&gt;(AbstractJdbc3Connection.java:28) 
      at org.postgresql.jdbc3g.AbstractJdbc3gConnection.&lt;init&gt;(AbstractJdbc3gConnection.java:20) 
      at org.postgresql.jdbc4.AbstractJdbc4Connection.&lt;init&gt;(AbstractJdbc4Connection.java:30) 
      at org.postgresql.jdbc4.Jdbc4Connection.&lt;init&gt;(Jdbc4Connection.java:22) 
      at org.postgresql.Driver.makeConnection(Driver.java:391) 
      at org.postgresql.Driver.connect(Driver.java:265) 
      at play.utils.ProxyDriver.connect(ProxyDriver.scala:9) 
      at java.sql.DriverManager.getConnection(Unknown Source) 
      at java.sql.DriverManager.getConnection(Unknown Source) 
      at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) 
      at com.jolbox.bonecp.BoneCP.&lt;init&gt;(BoneCP.java:305) 
      at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150) 
      at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112) 
      at play.api.db.DBApi$class.getConnection(DB.scala:64) 
      at play.api.db.BoneCPApi.getConnection(DB.scala:273) 
      at play.api.db.evolutions.Evolutions$.databaseEvolutions(Evolutions.scala:306) 
      at play.api.db.evolutions.Evolutions$.evolutionScript(Evolutions.scala:284) 
      at play.api.db.evolutions.OfflineEvolutions$.applyScript(Evolutions.scala:452) 
      at play.core.ReloadableApplication.handleWebCommand(ApplicationProvider.scala:175) 
      at play.core.server.Server$$anonfun$getHandlerFor$1.apply(Server.scala:86) 
      at play.core.server.Server$$anonfun$getHandlerFor$1.apply(Server.scala:86) 
      at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) 
      at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110) 
      at scala.util.control.Exception$Catch.apply(Exception.scala:88) 
      at scala.util.control.Exception$Catch.either(Exception.scala:110) 
      at play.core.server.Server$class.getHandlerFor(Server.scala:86) 
      at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:38) 
      at play.core.server.netty.PlayDefaultUpstreamHandler.messageReceived(PlayDefaultUpstreamHandler.scala:226) 
      at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) 
      at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) 
      at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) 
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) 
      at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) 
      at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) 
      at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) 
      at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) 
      at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) 
      at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553) 
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) 
      at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) 
      at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) 
      at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) 
      at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) 
      at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) 
      at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) 
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Dev databases have a fixed number of available connections (20 or so). How can I make sure I am properly closing my connections?</p>