Search in sources :

Example 1 with MysqlDataSource

use of com.mysql.jdbc.jdbc2.optional.MysqlDataSource in project spring-data-jdbc by spring-projects.

the class MySqlDataSourceConfiguration method createDataSource.

/*
	 * (non-Javadoc)
	 * @see org.springframework.data.jdbc.testing.DataSourceConfiguration#createDataSource()
	 */
@Override
protected DataSource createDataSource() {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setUrl(MYSQL_CONTAINER.getJdbcUrl());
    dataSource.setUser(MYSQL_CONTAINER.getUsername());
    dataSource.setPassword(MYSQL_CONTAINER.getPassword());
    dataSource.setDatabaseName(MYSQL_CONTAINER.getDatabaseName());
    return dataSource;
}
Also used : MysqlDataSource(com.mysql.jdbc.jdbc2.optional.MysqlDataSource)

Example 2 with MysqlDataSource

use of com.mysql.jdbc.jdbc2.optional.MysqlDataSource in project SpinalTap by airbnb.

the class MysqlSchemaUtil method createMysqlDBI.

public static DBI createMysqlDBI(@NotNull final String host, final int port, @NotNull final String user, @NotNull final String password, final String database) {
    MysqlDataSource dataSource = new MysqlConnectionPoolDataSource();
    dataSource.setUser(user);
    dataSource.setPassword(password);
    dataSource.setServerName(host);
    dataSource.setPort(port);
    dataSource.setJdbcCompliantTruncation(false);
    dataSource.setAutoReconnectForConnectionPools(true);
    if (database != null) {
        dataSource.setDatabaseName(database);
    }
    return new DBI(dataSource);
}
Also used : MysqlDataSource(com.mysql.jdbc.jdbc2.optional.MysqlDataSource) DBI(org.skife.jdbi.v2.DBI) MysqlConnectionPoolDataSource(com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource)

Example 3 with MysqlDataSource

use of com.mysql.jdbc.jdbc2.optional.MysqlDataSource in project brave by openzipkin.

the class ITTracingStatementInterceptor method init.

@Before
public void init() throws SQLException {
    StringBuilder url = new StringBuilder("jdbc:mysql://");
    url.append(envOr("MYSQL_HOST", "127.0.0.1"));
    url.append(":").append(envOr("MYSQL_TCP_PORT", 3306));
    String db = envOr("MYSQL_DB", null);
    if (db != null)
        url.append("/").append(db);
    url.append("?statementInterceptors=").append(TracingStatementInterceptor.class.getName());
    url.append("&zipkinServiceName=").append("myservice");
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setUrl(url.toString());
    dataSource.setUser(System.getenv("MYSQL_USER"));
    assumeTrue("Minimally, the environment variable MYSQL_USER must be set", dataSource.getUser() != null);
    dataSource.setPassword(envOr("MYSQL_PASS", ""));
    connection = dataSource.getConnection();
    spans.clear();
}
Also used : MysqlDataSource(com.mysql.jdbc.jdbc2.optional.MysqlDataSource) Before(org.junit.Before)

Aggregations

MysqlDataSource (com.mysql.jdbc.jdbc2.optional.MysqlDataSource)3 MysqlConnectionPoolDataSource (com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource)1 Before (org.junit.Before)1 DBI (org.skife.jdbi.v2.DBI)1