use of org.wso2.carbon.humantask.core.dao.DatabaseType in project carbon-business-process by wso2.
the class AbstractJPAVendorAdapter method determineDbType.
protected DatabaseType determineDbType() {
Connection con = null;
DatabaseType dbType = null;
try {
con = getDBConnection();
DatabaseMetaData metaData = con.getMetaData();
if (metaData != null) {
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
int dbMajorVer = metaData.getDatabaseMajorVersion();
if (log.isDebugEnabled()) {
log.debug("Using database " + dbProductName + " major version " + dbMajorVer);
}
if (dbProductName.contains("db2")) {
dbType = DatabaseType.DB2;
} else if (dbProductName.contains("oracle")) {
dbType = DatabaseType.ORACLE;
} else if (dbProductName.contains("derby")) {
dbType = DatabaseType.DERBY;
} else if (dbProductName.contains("h2")) {
dbType = DatabaseType.H2;
} else if (dbProductName.contains("hsql")) {
dbType = DatabaseType.HSQL;
} else if (dbProductName.contains("microsoft sql")) {
dbType = DatabaseType.SQL_SERVER;
} else if (dbProductName.contains("mysql")) {
dbType = DatabaseType.MYSQL;
} else if (dbProductName.contains("postgresql")) {
dbType = DatabaseType.POSTGRESQL;
} else if (dbProductName.contains("sybase")) {
dbType = DatabaseType.SYBASE;
}
}
} catch (SQLException e) {
log.warn("Unable to determine database dialect.", e);
} finally {
close(con);
}
return dbType;
}
use of org.wso2.carbon.humantask.core.dao.DatabaseType in project carbon-business-process by wso2.
the class AbstractJPAVendorAdapter method determineDbType.
protected DatabaseType determineDbType() {
Connection con = null;
DatabaseType dbType = null;
try {
con = getDBConnection();
DatabaseMetaData metaData = con.getMetaData();
if (metaData != null) {
String dbProductName = metaData.getDatabaseProductName().toLowerCase();
int dbMajorVer = metaData.getDatabaseMajorVersion();
if (log.isDebugEnabled()) {
log.debug("Using database " + dbProductName + " major version " + dbMajorVer);
}
if (dbProductName.contains("db2")) {
dbType = DatabaseType.DB2;
} else if (dbProductName.contains("oracle")) {
dbType = DatabaseType.ORACLE;
} else if (dbProductName.contains("derby")) {
dbType = DatabaseType.DERBY;
} else if (dbProductName.contains("h2")) {
dbType = DatabaseType.H2;
} else if (dbProductName.contains("hsql")) {
dbType = DatabaseType.HSQL;
} else if (dbProductName.contains("microsoft sql")) {
dbType = DatabaseType.SQL_SERVER;
} else if (dbProductName.contains("mysql")) {
dbType = DatabaseType.MYSQL;
} else if (dbProductName.contains("postgresql")) {
dbType = DatabaseType.POSTGRESQL;
} else if (dbProductName.contains("sybase")) {
dbType = DatabaseType.SYBASE;
}
}
} catch (SQLException e) {
log.warn("Unable to determine database dialect.", e);
} finally {
close(con);
}
return dbType;
}
Aggregations