private boolean isDataServicesConnection( IDatabaseConnection connection ) { return connection.getDatabaseType().getName().equals( new PDIDialect().getDatabaseType().getName() ); }
/** * Method is designed to check whether sql queries can be executed via connection with a {@core connName}. * For now we can't allow sql queries for connections, that are based on Pentaho Data Services. * See BISERVER-13225 for more info. * * @param connName * name of connection, to be examined for sql queries support * @throws ConnectionServiceException * if an error occurs while receiving connection with {@code connectionName} * @throws SqlQueriesNotSupportedException * if query is not supported for a connection with a {@code connectionName} */ void checkSqlQueriesSupported( String connName ) throws ConnectionServiceException, SqlQueriesNotSupportedException { IDatabaseConnection conn = connService.getConnectionByName( connName ); IDatabaseType dbType = conn.getDatabaseType(); if ( dbType.getName().equals( DB_TYPE_ID_PENTAHO_DATA_SERVICE ) ) { throw new SqlQueriesNotSupportedException( Messages .getErrorString( "DatasourceServiceImpl.ERROR_0024_SQL_QUERIES_NOT_SUPPORTED_FOR_PENTAHO_DATA_SERVICE" ) ); } }
@Before public void before() throws DatabaseDialectException { when( dialectService.getDialect( connection ) ).thenReturn( driverLocatorDialect ); when( connection.getDatabaseType() ).thenReturn( databaseType ); when( connection.getDatabaseType().getShortName() ).thenReturn( "SomeDBType" ); when( driverLocatorDialect.getNativeDriver() ).thenReturn( nativeDriverName ); when( driverLocatorDialect.getURLWithExtraOptions( connection ) ).thenReturn( jdbcUrl ); when( plainDialect.getNativeDriver() ).thenReturn( nativeDriverName ); when( plainDialect.getURLWithExtraOptions( connection ) ).thenReturn( jdbcUrl ); }
public static SQLConnection getConnection( String connectionName ) throws DatasourceServiceException { IDatabaseConnection connection = null; try { ConnectionServiceImpl service = new ConnectionServiceImpl(); connection = service.getConnectionByName( connectionName ); DatabaseDialectService dialectService = new DatabaseDialectService(); IDatabaseDialect dialect = dialectService.getDialect( connection ); String driverClass = null; if ( connection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { driverClass = connection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS ); } else { driverClass = dialect.getNativeDriver(); } return new SQLConnection( driverClass, dialect.getURLWithExtraOptions( connection ), connection.getUsername(), connection.getPassword(), null ); } catch ( ConnectionServiceException e1 ) { return null; } catch ( DatabaseDialectException e ) { return null; } }
"PooledDatasourceHelper.ERROR_0004_UNABLE_TO_POOL_DATASOURCE_NO_DIALECT", databaseConnection.getName() ) ); if ( databaseConnection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { //$NON-NLS-1$ driverClass = databaseConnection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS ); if ( StringUtils.isEmpty( driverClass ) ) {
"PooledDatasourceHelper.ERROR_0001_DATASOURCE_CANNOT_LOAD_DIALECT_SVC" ) ) ).getDialect( databaseConnection ); if ( databaseConnection.getDatabaseType() == null && dialect == null ) { if ( databaseConnection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { //$NON-NLS-1$ String driverClassName = databaseConnection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS );
IDatabaseDialect dialect = dialectService.getDialect( connection ); String driverClass = null; if ( connection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { driverClass = connection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS ); } else {
String driverClass = null; if ( connection.getDatabaseType().getShortName().equals( "GENERIC" ) ) { driverClass = connection.getAttributes().get( GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS ); } else {
private void write( final IDatabaseConnection databaseConnection, final XmlWriter writer ) throws IOException { final AttributeList rootAttrs = new AttributeList(); if ( databaseConnection.getDatabaseType() != null ) { rootAttrs.setAttribute( ConnectionModule.NAMESPACE, PROP_TYPE, databaseConnection.getDatabaseType() .getShortName() );
if ( databaseConnection.getDatabaseType() != null ) { rootNode.setProperty( PROP_TYPE, databaseConnection.getDatabaseType().getShortName() );
conn.setDatabaseName( connection.getDatabaseName() ); conn.setDatabasePort( connection.getDatabasePort() ); conn.setDatabaseType( connection.getDatabaseType() ); conn.setDataTablespace( connection.getDataTablespace() ); conn.setForcingIdentifiersToLowerCase( connection.isForcingIdentifiersToLowerCase() );
Text databaseTypeText = document.createTextNode( dbConn.getDatabaseType().getShortName() ); databaseType.appendChild( databaseTypeText ); databaseConnection.appendChild( databaseType );
protected void copyDatabaseConnectionProperties( IDatabaseConnection source, IDatabaseConnection target ) { target.setId( source.getId() ); target.setAccessType( source.getAccessType() ); target.setDatabaseType( source.getDatabaseType() ); target.setExtraOptions( source.getExtraOptions() ); target.setExtraOptionsOrder( source.getExtraOptionsOrder() );
protected void copyDatabaseConnectionProperties( IDatabaseConnection source, IDatabaseConnection target ) { target.setId( source.getId() ); target.setAccessType( source.getAccessType() ); target.setDatabaseType( source.getDatabaseType() ); target.setExtraOptions( source.getExtraOptions() ); target.setExtraOptionsOrder( source.getExtraOptionsOrder() );
connectionImpl.setDatabaseName( connectionBean.getDatabaseName() ); connectionImpl.setDatabasePort( connectionBean.getDatabasePort() ); connectionImpl.setDatabaseType( dbTypeBeanToImpl( connectionBean.getDatabaseType() ) ); connectionImpl.setDataTablespace( connectionBean.getDataTablespace() ); connectionImpl.setForcingIdentifiersToLowerCase( connectionBean.isForcingIdentifiersToLowerCase() );