use of org.apache.ignite.cache.store.jdbc.dialect.H2Dialect in project ignite by apache.
the class CacheJdbcPojoStoreFactorySelfTest method cacheConfigurationH2Dialect.
/**
* @return Cache configuration with store.
*/
private CacheConfiguration<Integer, String> cacheConfigurationH2Dialect() {
CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
CacheJdbcPojoStoreFactory<Integer, String> factory = new CacheJdbcPojoStoreFactory<>();
factory.setDataSourceBean("simpleDataSource");
factory.setDialect(new H2Dialect());
cfg.setCacheStoreFactory(factory);
return cfg;
}
use of org.apache.ignite.cache.store.jdbc.dialect.H2Dialect in project ignite by apache.
the class CacheAbstractJdbcStore method resolveDialect.
/**
* Perform dialect resolution.
*
* @return The resolved dialect.
* @throws CacheException Indicates problems accessing the metadata.
*/
protected JdbcDialect resolveDialect() throws CacheException {
Connection conn = null;
String dbProductName = null;
try {
conn = openConnection(false);
dbProductName = conn.getMetaData().getDatabaseProductName();
} catch (SQLException e) {
throw new CacheException("Failed access to metadata for detect database dialect.", e);
} finally {
U.closeQuiet(conn);
}
if ("H2".equals(dbProductName))
return new H2Dialect();
if ("MySQL".equals(dbProductName))
return new MySQLDialect();
if (dbProductName.startsWith("Microsoft SQL Server"))
return new SQLServerDialect();
if ("Oracle".equals(dbProductName))
return new OracleDialect();
if (dbProductName.startsWith("DB2/"))
return new DB2Dialect();
U.warn(log, "Failed to resolve dialect (BasicJdbcDialect will be used): " + dbProductName);
return new BasicJdbcDialect();
}
Aggregations