Java Code Examples for org.dbunit.ext.mysql.MySqlConnection

The following examples show how to use org.dbunit.ext.mysql.MySqlConnection. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: sharding-jdbc-1.5.1   Source File:    License: Apache License 2.0 6 votes vote down vote up
public static IDatabaseConnection getConnection(final DataBaseEnvironment dbEnv, final Connection connection) throws DatabaseUnitException {
    switch (dbEnv.getDatabaseType()) {
        case H2:
            return new H2Connection(connection, "PUBLIC");
        case MySQL:
            return new MySqlConnection(connection, null);
        case PostgreSQL:
            DatabaseConnection databaseConnection = new DatabaseConnection(connection);
            databaseConnection.getConfig().setProperty("", new PostgresqlDataTypeFactory());
            return databaseConnection;
        case Oracle:
            return new OracleConnection(connection, "JDBC");
        case SQLServer:
            return new MsSqlConnection(connection);
            throw new UnsupportedOperationException(dbEnv.getDatabaseType().name());
Example 2
private static IDatabaseConnection getDatabaseConnection() throws ClassNotFoundException, SQLException,
        DatabaseUnitException {
    Connection jdbcConnection = DriverManager.getConnection("jdbc:mysql://localhost:3306/epcis?autoReconnect=true",
            "epcis", "epcis");
    IDatabaseConnection connection = new MySqlConnection(jdbcConnection, "epcis");
    return connection;
Example 3
Source Project: cloudstack   Source File:    License: Apache License 2.0 5 votes vote down vote up
public void setUp() throws Exception {
    PropertiesUtil.loadFromFile(properties, PropertiesUtil.findConfigFile(""));

    cloudConn = createConnection("cloud");
    usageConn = createConnection("usage");

    dbuCloudConn = new MySqlConnection(cloudConn, properties.getProperty(""));
    dbuUsageConn = new MySqlConnection(usageConn, properties.getProperty(""));
    cloudDataSet = getCloudDataSet();
    usageDataSet = getUsageDataSet();
    DatabaseOperation.CLEAN_INSERT.execute(dbuCloudConn, cloudDataSet);
    DatabaseOperation.CLEAN_INSERT.execute(dbuUsageConn, usageDataSet);
Example 4
Source Project: jpa-unit   Source File:    License: Apache License 2.0 4 votes vote down vote up
public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException {
    return new MySqlConnection(connection, schema);