title: Connection not available in Play for Scala
body: <p>I have the following configuration in <code>application.conf</code> for an in-memory database HSQLDB:</p>
  
  <pre><code>db {
     inmemory {
         jndiName = jndiInMemory
         driver = org.hsqldb.jdbc.JDBCDriver
         url = "jdbc:hsqldb:mem:inmemory"
    }
  }
  </code></pre>
  
  <p>And connect in a controller with the following statements</p>
  
  <pre><code>val database = Database.forName("jndiInMemory")
  val session = database.createSession
  val conn = session.conn
  //  JDBC statements
  </code></pre>
  
  <p>Problem is that when the code runs several times, I get an exception in  <code>session.conn</code>: </p>
  
  <blockquote>
    <p>HikariPool-34 - Connection is not available, request timed out after
    30000ms.</p>
  </blockquote>
  
  <p>Since I'm using JNDI, I figured that the connections are reused. Do I have to drop the session after I finish using it? How to fix this code?</p>