Search in sources :

Example 1 with DB2Dialect

use of org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect 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();
}
Also used : MySQLDialect(org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect) SQLServerDialect(org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect) H2Dialect(org.apache.ignite.cache.store.jdbc.dialect.H2Dialect) OracleDialect(org.apache.ignite.cache.store.jdbc.dialect.OracleDialect) SQLException(java.sql.SQLException) CacheException(javax.cache.CacheException) Connection(java.sql.Connection) BasicJdbcDialect(org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect) DB2Dialect(org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect)

Aggregations

Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 CacheException (javax.cache.CacheException)1 BasicJdbcDialect (org.apache.ignite.cache.store.jdbc.dialect.BasicJdbcDialect)1 DB2Dialect (org.apache.ignite.cache.store.jdbc.dialect.DB2Dialect)1 H2Dialect (org.apache.ignite.cache.store.jdbc.dialect.H2Dialect)1 MySQLDialect (org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect)1 OracleDialect (org.apache.ignite.cache.store.jdbc.dialect.OracleDialect)1 SQLServerDialect (org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect)1