use of org.pentaho.platform.api.data.DBDatasourceServiceException in project pentaho-platform by pentaho.
the class PlatformKettleDataSourceProvider method getNamedDataSourceFromService.
protected <T extends IDBDatasourceService> DataSource getNamedDataSourceFromService(Class<T> dataSourceServiceInterface, String dataSourceName) throws DataSourceNamingException {
T datasourceService = PentahoSystem.get(dataSourceServiceInterface, null);
IDBDatasourceService service = (datasourceService == null) ? PentahoSystem.get(IDBDatasourceService.class, null) : datasourceService;
if (service != null) {
try {
return service.getDataSource(dataSourceName);
} catch (DBDatasourceServiceException ex) {
throw new DataSourceNamingException(ex);
}
}
return null;
}
use of org.pentaho.platform.api.data.DBDatasourceServiceException in project data-access by pentaho.
the class AgileHelper method getDialect.
public static String getDialect(DatabaseMeta meta, String jndiName) {
String dialect = null;
try {
Connection conn = getConnection(jndiName);
dialect = conn.getMetaData().getDatabaseProductName();
if (dialect.indexOf("HSQL") >= 0) {
dialect = "Hypersonic";
} else if (dialect.indexOf("Microsoft SQL") >= 0) {
// Hack-around for BACKLOG-845
dialect = "MSSQLNATIVE";
}
conn.close();
} catch (SQLException e) {
logger.debug("Error determining database type from connection", e);
} catch (DBDatasourceServiceException e) {
logger.debug("Error determining database type from connection - getting JNDI connection", e);
}
return dialect;
}
Aggregations