use of org.alfresco.repo.domain.dialect.SQLServerDialect in project alfresco-repository by Alfresco.
the class DataSourceCheck method init.
public void init() {
logger.info(I18NUtil.getMessage(MSG_DB_CONNECTION, dbUrl, dbUsername));
Connection con = null;
try {
con = dataSource.getConnection();
con.setAutoCommit(true);
DatabaseMetaData meta = con.getMetaData();
logger.info(I18NUtil.getMessage(MSG_DB_VERSION, meta.getDatabaseProductName(), meta.getDatabaseProductVersion()));
Dialect dialect = DialectFactory.buildDialect(meta.getDatabaseProductName(), meta.getDatabaseMajorVersion(), meta.getDriverName());
// Check MS SQL Server specific settings
if (dialect instanceof SQLServerDialect) {
if (transactionIsolation != SQL_SERVER_TRANSACTION_ISOLATION) {
throw new AlfrescoRuntimeException(ERR_WRONG_TRANSACTION_ISOLATION_SQL_SERVER, new Object[] { transactionIsolation, SQL_SERVER_TRANSACTION_ISOLATION });
}
}
} catch (RuntimeException re) {
// just rethrow
throw re;
} catch (Exception e) {
throw new AlfrescoRuntimeException(ERR_DB_CONNECTION, new Object[] { e.getMessage() }, e);
} finally {
try {
con.close();
} catch (Exception e) {
}
}
}
use of org.alfresco.repo.domain.dialect.SQLServerDialect in project alfresco-repository by Alfresco.
the class SchemaBootstrap method checkDialect.
/**
* Performs dialect-specific checking. This includes checking for InnoDB, dumping the dialect being used
* as well as setting any runtime, dialect-specific properties.
*/
private void checkDialect(Dialect dialect) {
Class<?> dialectClazz = dialect.getClass();
LogUtil.info(logger, MSG_DIALECT_USED, dialectClazz.getName());
// if (dialectClazz.equals(MySQLDialect.class) || dialectClazz.equals(MySQL5Dialect.class))
// {
// LogUtil.error(logger, ERR_DIALECT_SHOULD_USE, dialectClazz.getName(), MySQLInnoDBDialect.class.getName());
// throw AlfrescoRuntimeException.create(WARN_DIALECT_UNSUPPORTED, dialectClazz.getName());
// }
// else if (dialectClazz.equals(HSQLDialect.class))
// {
// LogUtil.info(logger, WARN_DIALECT_HSQL);
// }
// else if (dialectClazz.equals(DerbyDialect.class))
// {
// LogUtil.info(logger, WARN_DIALECT_DERBY);
// }
// else if (dialectClazz.equals(Oracle9iDialect.class) || dialectClazz.equals(Oracle10gDialect.class))
// {
// LogUtil.error(logger, ERR_DIALECT_SHOULD_USE, dialectClazz.getName(), Oracle9Dialect.class.getName());
// throw AlfrescoRuntimeException.create(WARN_DIALECT_UNSUPPORTED, dialectClazz.getName());
// }
// else if (dialectClazz.equals(OracleDialect.class) || dialectClazz.equals(Oracle9Dialect.class))
// {
// LogUtil.error(logger, ERR_DIALECT_SHOULD_USE, dialectClazz.getName(), Oracle9Dialect.class.getName());
// throw AlfrescoRuntimeException.create(WARN_DIALECT_UNSUPPORTED, dialectClazz.getName());
// }
int maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
int serializableType = SerializableTypeHandler.getSerializableType();
// Adjust the maximum allowable String length according to the dialect
if (dialect instanceof SQLServerDialect) {
// string_value nvarchar(1024) null,
// serializable_value image null,
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
} else if (dialect instanceof MySQLClusterNDBDialect) {
// string_value varchar(400),
// serializable_value blob,
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH_NDB;
} else if (dialect instanceof MySQLInnoDBDialect) {
// string_value text,
// serializable_value blob,
maxStringLength = Integer.MAX_VALUE;
} else if (dialect instanceof Oracle9Dialect) {
// string_value varchar2(1024 char),
// serializable_value blob,
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
} else if (dialect instanceof PostgreSQLDialect) {
// string_value varchar(1024),
// serializable_value bytea,
maxStringLength = SchemaBootstrap.DEFAULT_MAX_STRING_LENGTH;
}
SchemaBootstrap.setMaxStringLength(maxStringLength, dialect);
SerializableTypeHandler.setSerializableType(serializableType);
// Now override the maximum string length if it was set directly
if (maximumStringLength > 0) {
SchemaBootstrap.setMaxStringLength(maximumStringLength, dialect);
}
}
use of org.alfresco.repo.domain.dialect.SQLServerDialect in project alfresco-repository by Alfresco.
the class TypeNameOnlyValidatorTest method setUp.
@Before
public void setUp() throws Exception {
validator = new TypeNameOnlyValidator();
validationResults = new Results();
ctx = new DiffContext(new SQLServerDialect(), validationResults, null, null);
}
Aggregations