title: Cannot create PoolableConnectionFactory error while starting application in Bluemix
body: <p>Once I deploy my Java Application to IBM Bluemix, it can't create the initial database connection due to this error:</p>
  
  <blockquote>
    <p>Building new Hibernate SessionFactory 2015-04-11 14:24:04 [main] ERROR
    o.h.util.JDBCExceptionReporter - Cannot create
    PoolableConnectionFactory (Communications link failure The last packet
    sent successfully to the server was 0 milliseconds ago. The driver has
    not received any packets from the server.)</p>
  </blockquote>
  
  <p>I tried to set the "hibernate.current_session_context_class" to "thread" (which solved the problem when I deployed the same app to Google Application Engine) but that didn't help with Websphere Liberty Profile:</p>
  
  <pre><code>&lt;prop key="hibernate.current_session_context_class" &gt;
          thread
   &lt;/prop&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>UPDATE 1 ---</strong> This is the actual root cause. Bluemix offers the ClearDB MySQL service but its pipeline cannot connect to it :(</p>
  
  <blockquote>
    <p>Building new Hibernate SessionFactory 2015-04-11 15:04:49 [main] ERROR
    o.h.util.JDBCExceptionReporter - Communications link failure</p>
    
    <p>The last packet sent successfully to the server was 0 milliseconds
    ago. The driver has not received any packets from the server.</p>
  </blockquote>
  
  <p><strong>UPDATE 2 ---</strong> Even the Experimental MySQL DB is also off limits if there's any attempt to connect from the pipeline machines:</p>
  
  <blockquote>
    <p>o.h.util.JDBCExceptionReporter - Cannot create
    PoolableConnectionFactory (Communications link failure</p>
    
    <p>The last packet sent successfully to the server was 0 milliseconds
    ago. The driver has not received any packets from the server.)
    org.hibernate.exception.GenericJDBCException: Cannot open connection
      at
    org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
      at org.hibe     at
    org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
      at
    org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
    PoolableConnectionFactory (Communications link failure</p>
    
    <p>The last packet sent successfully to the server was 0 milliseconds
    ago. The driver has not received any packets from the server.)    at
    org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
      at
    org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
      at
    org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at
    org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
      at
    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
      ... 40 more Caused by:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
    Communications link failure</p>
  </blockquote>
  
  <p>Please let me know if you have any ideas.</p>