title: Flyway migration, Unable to obtain Jdbc connection from DataSource
body: <p>I am trying to use flyway to create and manage a MySQL database. Here is the code i have got so far.</p>
  <p>FlywayMigration.java : Class that applys the migration</p>
  <pre><code>public class FlywayMigration
  {
      public FlywayMigration(DatabaseConfiguration configuration, Flyway flyway)
      {
          flyway.setDataSource(configuration.getDataSource());
          flyway.migrate();
      }
  
      public static void main(String[] args)
      {
          new FlywayMigration(new DatabaseConfiguration(&quot;database.properties&quot;), new Flyway());
      }
  }
  </code></pre>
  <p>DatabaseConfiguration.java : Configuration class, this class will configure the datasource to be applyed to the Flyway.setDataSource method</p>
  <pre><code>public class DatabaseConfiguration
  {
      private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
  
      private PropertiesUtil prop = null;
  
      public DatabaseConfiguration(String file)
      {
          prop = new PropertiesUtil(file);
      }
  
      public String getDataSourceClass()
      {
          return prop.getProperty(&quot;mysql.data.source.class&quot;);
      }
  
      public String getURL ()
      {
          return prop.getProperty(&quot;mysql.url&quot;);
      }
  
      public String getHostName()
      {
          return prop.getProperty(&quot;mysql.host.name&quot;);
      }
  
      public String getDatabaseName()
      {
          return prop.getProperty(&quot;mysql.database.name&quot;);
      }
  
      public DataSource getDataSource()
      {
          MysqlDataSource dataSource = new MysqlDataSource();
          dataSource.setURL(getURL());
          dataSource.setUser(prop.getProperty(&quot;mysql.user.name&quot;));
          dataSource.setPassword(null);
          return dataSource;
      }
  }
  </code></pre>
  <p>database.properties is the file where i store the database information, password can be null</p>
  <pre><code>mysql.data.source.class=com.mysql.jdbc.Driver    
  mysql.url=jdbc:mysql://localhost:3306/vmrDB    
  mysql.host.name=localhost    
  mysql.database.name=vmrDB    
  mysql.user.name=root
  </code></pre>
  <p>And i get the folowing error in my trace</p>
  <pre><code>Exception in thread &quot;main&quot; org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
      at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
      at org.flywaydb.core.Flyway.execute(Flyway.java:1144)
      at org.flywaydb.core.Flyway.migrate(Flyway.java:811)
      at com.bt.sitb.vmr.migration.FlywayMigration.&lt;init&gt;(FlywayMigration.java:10)
      at com.bt.sitb.vmr.migration.FlywayMigration.main(FlywayMigration.java:15)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  </code></pre>
  <p>Can someone please tell me why the DataSource from MySQL is not connecting?</p>