Search in sources :

Example 1 with DatabaseType

use of org.infinispan.persistence.jdbc.common.DatabaseType in project infinispan by infinispan.

the class JdbcConfigurationUtil method configureDbMeta.

private static void configureDbMeta(StoreProperties props, JdbcStringBasedStoreConfigurationBuilder builder) {
    props.required(DIALECT);
    DatabaseType type = DatabaseType.valueOf(props.get(DIALECT).toUpperCase());
    builder.dialect(type);
    String prop;
    if ((prop = props.get(DB, MAJOR_VERSION)) != null) {
        builder.dbMajorVersion(new Integer(prop));
    }
    if ((prop = props.get(DB, MINOR_VERSION)) != null) {
        builder.dbMinorVersion(new Integer(prop));
    }
    String disableUpsert = props.get(DB, DISABLE_UPSERT);
    boolean upsert = Boolean.parseBoolean(disableUpsert);
    if (upsert)
        builder.addProperty(TableManagerFactory.UPSERT_DISABLED, disableUpsert);
    String disableIndexing = props.get(DB, DISABLE_INDEXING);
    boolean indexing = Boolean.parseBoolean(disableIndexing);
    if (indexing)
        builder.addProperty(TableManagerFactory.INDEXING_DISABLED, disableIndexing);
}
Also used : DatabaseType(org.infinispan.persistence.jdbc.common.DatabaseType)

Example 2 with DatabaseType

use of org.infinispan.persistence.jdbc.common.DatabaseType in project infinispan by infinispan.

the class AbstractSQLStoreFunctionalTest method getDatabases.

protected static HashMap<DatabaseType, JdbcConnection> getDatabases() {
    Objects.requireNonNull(JDBC_URL);
    Objects.requireNonNull(JDBC_USERNAME);
    Objects.requireNonNull(JDBC_PASSWORD);
    Objects.requireNonNull(DATABASE);
    List<DatabaseType> databaseTypes = Arrays.stream(DATABASE.split(",")).map(DatabaseType::guessDialect).collect(Collectors.toList());
    HashMap<DatabaseType, JdbcConnection> map = new HashMap<>();
    for (int i = 0; i < databaseTypes.size(); i++) {
        String jdbcURL = JDBC_URL.split(",")[i];
        String username = JDBC_USERNAME.split(",")[i];
        String password = JDBC_PASSWORD.split(",")[i];
        JdbcConnection jdbcConnection = new JdbcConnection(jdbcURL, username, password);
        DatabaseType databaseType = databaseTypes.get(i);
        map.put(databaseType, jdbcConnection);
    }
    return map;
}
Also used : DatabaseType(org.infinispan.persistence.jdbc.common.DatabaseType) HashMap(java.util.HashMap) JdbcConnection(util.JdbcConnection)

Aggregations

DatabaseType (org.infinispan.persistence.jdbc.common.DatabaseType)2 HashMap (java.util.HashMap)1 JdbcConnection (util.JdbcConnection)1