title: Tomcat dataSource getConnection hang
body: <p>I have a problem when getting connection from Tomcat dataSource.</p>
  
  <p>Here are the config files:</p>
  
  <ol>
  <li><code>server.xml</code></li>
  </ol>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Resource name="jdbc/mssql" auth="Container"
        type="javax.sql.DataSource" removeAbandoned="true"
            removeAbandonedTimeout="30" maxActive="-1"
            maxIdle="-1" maxWait="10000"      username="xxx" password="xxx"       driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"      url="jdbc:sqlserver://xxx.xxx.xxx.xxx:1433;databaseName=XXX" /&gt;
  </code></pre>
  
  <ol>
  <li><code>context.xml</code></li>
  </ol>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ResourceLink global="jdbc/mssql" name="jdbc/mssql" type="javax.sql.DataSource" /&gt;
  </code></pre>
  
  <p>From my application code:</p>
  
  <pre class="lang-java prettyprint-override"><code>InitialContext initContext = new InitialContext();
  
  if(initContext == null) {
      String message = "There was no context in tomcat server..";
      throw new Exception(message);
  }
  DataSource datasourceLocal = null;
  datasourceLocal = (DataSource)initContext.lookup("java:/comp/env/jdbc/mssql");
  
  if(datasourceLocal == null){
     String message = "Could not find the dataSource in tomcat server..";
     throw new Exception(message);
  }
  else {
      logger.info("ConnPool Success..");
  }
  
  Connection conn = datasourceLocal.getConnection();
  </code></pre>
  
  <p>I have 2 database servers (replace the IP with xxx.xxx.xxx.xxx in <code>server.xml</code>), its working fine with 1st one, but with the 2nd one, it just hangs on the getting Connection line (I put some trace before and after this line).</p>