dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
dataSource.setMaxWait(2000); // 2 seconds max for wait a connection.
DdlGenerator generator = new DdlGenerator();
for (Class<?> clazz : classes) {
generator.addTable(clazz);
}
// get the Database model
Database database = generator.getDatabase();
Platform platform = PlatformFactory.createNewPlatformInstance("mysql");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(url, username, password);