Java Code Examples for org.dbunit.ext.postgresql.PostgresqlDataTypeFactory

The following examples show how to use org.dbunit.ext.postgresql.PostgresqlDataTypeFactory. 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
public IDatabaseConnection getConnection() throws Exception {
    IDatabaseConnection result = super.getConnection();
    DatabaseConfig dbConfig = result.getConfig();
    dbConfig.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
    dbConfig.setProperty(DatabaseConfig.FEATURE_DATATYPE_WARNING, false);
    if ("org.h2.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
    } else if ("com.mysql.jdbc.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
    } else if ("org.postgresql.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
    } else if ("oracle.jdbc.driver.OracleDriver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());
    } else if ("".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MsSqlDataTypeFactory());
    return result;
Example 2
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 3
Source Project: database-rider   Source File:    License: Apache License 2.0 6 votes vote down vote up
private IDataTypeFactory getDataTypeFactory(DBType dbType) {
    switch (dbType) {
        case HSQLDB:
            return new HsqldbDataTypeFactory();
        case H2:
            return new H2DataTypeFactory();
        case MYSQL:
            return new MySqlDataTypeFactory();
        case POSTGRESQL:
            return new PostgresqlDataTypeFactory();
        case ORACLE:
            return new Oracle10DataTypeFactory();
        case MSSQL:
            return new MsSqlDataTypeFactory();
        case DB2:
        	return new Db2DataTypeFactory();
            return null;
Example 4
Source Project: jpa-unit   Source File:    License: Apache License 2.0 5 votes vote down vote up
public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException {
    final IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection, schema);

    dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());

    return dbUnitConnection;
Example 5
Source Project: proarc   Source File:    License: GNU General Public License v3.0 5 votes vote down vote up
private IDatabaseConnection createProgresConnection(Connection c) throws DatabaseUnitException {
    DatabaseConnection dbc = new DatabaseConnection(c);
    DatabaseConfig config = dbc.getConfig();
    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
    // Progress cannot handle columns names like XML thus we have to escape them.
    config.setProperty(DatabaseConfig.PROPERTY_ESCAPE_PATTERN, "\"?\"");
    config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
    return dbc;