package com.proofpoint.dbpool;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;

import static java.lang.Math.ceil;
import static java.util.concurrent.TimeUnit.SECONDS;

public class MySqlDataSource extends ManagedDataSource
{
    public MySqlDataSource(MySqlDataSourceConfig config)
    {
        super(createMySQLConnectionPoolDataSource(config),
                config.getMaxConnections(),
                config.getMaxConnectionWait());
    }

    private static MysqlConnectionPoolDataSource createMySQLConnectionPoolDataSource(MySqlDataSourceConfig config) {
        MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource();
        dataSource.setServerName(config.getHost());
        dataSource.setPort(config.getPort());
        dataSource.setDatabaseName(config.getDatabaseName());
        dataSource.setConnectTimeout((int) ceil(config.getMaxConnectionWait().convertTo(SECONDS)));
        dataSource.setInitialTimeout((int) ceil(config.getMaxConnectionWait().convertTo(SECONDS)));
        dataSource.setSocketTimeout((int) ceil(config.getMaxConnectionWait().toMillis()));
        dataSource.setDefaultFetchSize(config.getDefaultFetchSize());
        dataSource.setUseSSL(config.getUseSsl());
        return dataSource;
    }
}

@@ -714,24 +714,128 @@
 getHost());%0A
+        dataSource.setUser(config.getUsername());%0A        dataSource.setPassword(config.getPassword());%0A
         data
@@ -1134,99 +1134,8 @@
 ));%0A
-        dataSource.setSocketTimeout((int) ceil(config.getMaxConnectionWait().toMillis()));%0A
     

Set username, password and don't set socket timeout