use of com.j256.ormlite.db.SqlServerDatabaseType in project entando-core by entando.
the class TableFactory method createConnectionSource.
private ConnectionSource createConnectionSource() throws ApsSystemException {
ConnectionSource connectionSource = null;
try {
DataSource dataSource = this.getDataSource();
IDatabaseManager.DatabaseType type = this.getType();
String url = this.invokeGetMethod("getUrl", dataSource);
String username = this.invokeGetMethod("getUsername", dataSource);
String password = this.invokeGetMethod("getPassword", dataSource);
com.j256.ormlite.db.DatabaseType dataType = null;
if (type.equals(IDatabaseManager.DatabaseType.DERBY)) {
dataType = new ApsDerbyEmbeddedDatabaseType();
url = url + ";user=" + username + ";password=" + password;
connectionSource = new JdbcConnectionSource(url, dataType);
} else {
if (type.equals(IDatabaseManager.DatabaseType.POSTGRESQL)) {
dataType = new PostgresDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.MYSQL)) {
dataType = new MysqlDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.ORACLE)) {
dataType = new ApsOracleDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.SQLSERVER)) {
dataType = new SqlServerDatabaseType();
}
connectionSource = new JdbcConnectionSource(url, username, password, dataType);
}
} catch (Throwable t) {
_logger.error("Error creating connectionSource to db {}", this.getDatabaseName(), t);
throw new ApsSystemException("Error creating connectionSource to db " + this.getDatabaseName(), t);
}
return connectionSource;
}
use of com.j256.ormlite.db.SqlServerDatabaseType in project entando-engine by entando.
the class TableFactory method createConnectionSource.
private ConnectionSource createConnectionSource() throws EntException {
ConnectionSource connectionSource = null;
try {
DataSource dataSource = this.getDataSource();
IDatabaseManager.DatabaseType type = this.getType();
String url = this.invokeGetMethod("getUrl", dataSource);
String username = this.invokeGetMethod("getUsername", dataSource);
String password = this.invokeGetMethod("getPassword", dataSource);
com.j256.ormlite.db.DatabaseType dataType = null;
if (type.equals(IDatabaseManager.DatabaseType.DERBY)) {
dataType = new ApsDerbyEmbeddedDatabaseType();
url = url + ";user=" + username + ";password=" + password;
connectionSource = new JdbcConnectionSource(url, dataType);
} else {
if (type.equals(IDatabaseManager.DatabaseType.POSTGRESQL)) {
dataType = new PostgresDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.MYSQL)) {
dataType = new MysqlDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.ORACLE)) {
dataType = new ApsOracleDatabaseType();
} else if (type.equals(IDatabaseManager.DatabaseType.SQLSERVER)) {
dataType = new SqlServerDatabaseType();
}
connectionSource = new JdbcConnectionSource(url, username, password, dataType);
}
} catch (Throwable t) {
_logger.error("Error creating connectionSource to db {}", this.getDatabaseName(), t);
throw new EntException("Error creating connectionSource to db " + this.getDatabaseName(), t);
}
return connectionSource;
}
Aggregations