title: Configure datasource in Heroku deployment with JNDI lookup
body: <p>I am currently using JNDI lookup to get my datasource from Tomcat's context.xml for either MySQL or PostgreSQL.
  My context.xml looks like this:</p>
  
  <pre><code>&lt;Resource name="jdbc/MyDataSource"
            auth="Container"
            type="javax.sql.DataSource"
            username="user"
            password="pass"
            driverClassName="org.postgresql.Driver"
            url="jdbc:postgresql://servername:5432/database"
            maxActive="20"
            maxIdle="10"
            validationQuery="Select 1"
  /&gt;
  </code></pre>
  
  <p>However, one of my clients is using <strong>Heroku</strong> for deployment and I am wondering how I can set my datasource there and how to read it from my Java web app using JNDI lookup.
  In Heroku I am using the <a href="https://devcenter.heroku.com/articles/war-deployment" rel="nofollow">heroku-deploy plugin with Tomcat</a></p>