Search in sources :

Example 71 with DBPConnectionConfiguration

use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by dbeaver.

the class OracleConnectionPage method saveSettings.

@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
    DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
    connectionInfo.setClientHomeId(oraHomeSelector.getSelectedHome());
    connectionInfo.setProviderProperty(OracleConstants.PROP_CONNECTION_TYPE, connectionType.name());
    switch(connectionType) {
        case BASIC:
            connectionInfo.setHostName(hostText.getText().trim());
            connectionInfo.setHostPort(portText.getText().trim());
            connectionInfo.setDatabaseName(serviceNameCombo.getText().trim());
            break;
        case TNS:
            connectionInfo.setDatabaseName(tnsNameCombo.getText().trim());
            connectionInfo.setProviderProperty(OracleConstants.PROP_TNS_PATH, tnsPathText.getText().trim());
            break;
        case CUSTOM:
            connectionInfo.setUrl(connectionUrlText.getText().trim());
            break;
    }
    connectionInfo.setProviderProperty(OracleConstants.PROP_SID_SERVICE, OracleConnectionType.getTypeForTitle(sidServiceCombo.getText()).name());
    super.saveSettings(dataSource);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 72 with DBPConnectionConfiguration

use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by dbeaver.

the class OracleDataSourceProvider method getObjectInformation.

@Nullable
@Override
public String getObjectInformation(@NotNull DBPObject object, @NotNull String infoType) {
    if (object instanceof DBPDataSourceContainer && infoType.equals(INFO_TARGET_ADDRESS)) {
        DBPConnectionConfiguration connectionInfo = ((DBPDataSourceContainer) object).getConnectionConfiguration();
        OracleConstants.ConnectionType connectionType = getConnectionType(connectionInfo);
        if (connectionType == OracleConstants.ConnectionType.CUSTOM) {
            return JDBCURL.generateUrlByTemplate(connectionInfo.getUrl(), connectionInfo);
        }
        String databaseName = CommonUtils.notEmpty(connectionInfo.getDatabaseName());
        if (connectionType == OracleConstants.ConnectionType.TNS) {
            return databaseName;
        } else {
            String hostName = DataSourceUtils.getTargetTunnelHostName(connectionInfo);
            String hostPort = connectionInfo.getHostPort();
            if (CommonUtils.isEmpty(hostName)) {
                return null;
            } else if (CommonUtils.isEmpty(hostPort)) {
                return hostName;
            } else {
                return hostName + ":" + hostPort;
            }
        }
    }
    return null;
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) OracleConstants(org.jkiss.dbeaver.ext.oracle.model.OracleConstants) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) Nullable(org.jkiss.code.Nullable)

Example 73 with DBPConnectionConfiguration

use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by dbeaver.

the class OracleConnectionExtraPage method loadSettings.

@Override
public void loadSettings() {
    // oraHomeSelector.setVisible(isOCI);
    // Load values from new connection info
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    Map<String, String> providerProperties = connectionInfo.getProviderProperties();
    // Settings
    final Object nlsLanguage = providerProperties.get(OracleConstants.PROP_SESSION_LANGUAGE);
    if (nlsLanguage != null) {
        languageCombo.setText(nlsLanguage.toString());
    }
    final Object nlsTerritory = providerProperties.get(OracleConstants.PROP_SESSION_TERRITORY);
    if (nlsTerritory != null) {
        territoryCombo.setText(nlsTerritory.toString());
    }
    nlsDateFormat.setText(CommonUtils.toString(providerProperties.get(OracleConstants.PROP_SESSION_NLS_DATE_FORMAT)));
    nlsTimestampFormat.setText(CommonUtils.toString(providerProperties.get(OracleConstants.PROP_SESSION_NLS_TIMESTAMP_FORMAT)));
    nlsLengthFormat.setText(CommonUtils.toString(providerProperties.get(OracleConstants.PROP_SESSION_NLS_LENGTH_FORMAT)));
    nlsCurrencyFormat.setText(CommonUtils.toString(providerProperties.get(OracleConstants.PROP_SESSION_NLS_CURRENCY_FORMAT)));
    final Object checkSchemaContent = providerProperties.get(OracleConstants.PROP_CHECK_SCHEMA_CONTENT);
    if (checkSchemaContent != null) {
        hideEmptySchemasCheckbox.setSelection(CommonUtils.getBoolean(checkSchemaContent, false));
    }
    showDBAAlwaysCheckbox.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_ALWAYS_SHOW_DBA), false));
    useDBAViewsCheckbox.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_ALWAYS_USE_DBA_VIEWS), false));
    useSysSchemaCheckbox.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_METADATA_USE_SYS_SCHEMA), false));
    useSimpleConstraints.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_METADATA_USE_SIMPLE_CONSTRAINTS), false));
    useRuleHint.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_USE_RULE_HINT), false));
    useOptimizerHint.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_USE_META_OPTIMIZER), false));
    useAlternativeTableMetadataQuery.setSelection(CommonUtils.getBoolean(providerProperties.get(OracleConstants.PROP_METADATA_USE_ALTERNATIVE_TABLE_QUERY), false));
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 74 with DBPConnectionConfiguration

use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by dbeaver.

the class PostgreNativeToolHandler method fillProcessParameters.

@Override
public void fillProcessParameters(SETTINGS settings, PROCESS_ARG process_arg, List<String> cmd) throws IOException {
    File dumpBinary = RuntimeUtils.getNativeClientBinary(settings.getClientHome(), PostgreConstants.BIN_FOLDER, this instanceof PostgreDatabaseBackupHandler ? "pg_dump" : // $NON-NLS-1$
    this instanceof PostgreDatabaseRestoreHandler ? "pg_restore" : "psql");
    String dumpPath = dumpBinary.getAbsolutePath();
    cmd.add(dumpPath);
    if (isVerbose()) {
        cmd.add("--verbose");
    }
    DBPConnectionConfiguration connectionInfo = settings.getDataSourceContainer().getActualConnectionConfiguration();
    cmd.add("--host=" + connectionInfo.getHostName());
    if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
        cmd.add("--port=" + connectionInfo.getHostPort());
    }
    String toolUserName = settings.getToolUserName();
    if (CommonUtils.isEmpty(toolUserName)) {
        toolUserName = connectionInfo.getUserName();
    }
    cmd.add("--username=" + toolUserName);
    settings.addExtraCommandArgs(cmd);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) File(java.io.File)

Example 75 with DBPConnectionConfiguration

use of org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration in project dbeaver by dbeaver.

the class ExasolConnectionPage method saveSettings.

@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
    DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
    if (hostText != null) {
        connectionInfo.setHostName(hostText.getText().trim());
    }
    if (portText != null) {
        connectionInfo.setHostPort(portText.getText().trim());
    }
    connectionInfo.setProviderProperty(ExasolUIConstants.DRV_BACKUP_HOST_LIST, backupHostText.getText());
    if (this.encryptCommunication.getSelection())
        // $NON-NLS-1$
        connectionInfo.setProviderProperty(ExasolUIConstants.DRV_ENCRYPT, "1");
    super.saveSettings(dataSource);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Aggregations

DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)172 DBException (org.jkiss.dbeaver.DBException)25 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)18 DataSourceDescriptor (org.jkiss.dbeaver.registry.DataSourceDescriptor)16 DBPDriver (org.jkiss.dbeaver.model.connection.DBPDriver)14 DBWHandlerConfiguration (org.jkiss.dbeaver.model.net.DBWHandlerConfiguration)12 ArrayList (java.util.ArrayList)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 GridData (org.eclipse.swt.layout.GridData)10 DBPDataSourceRegistry (org.jkiss.dbeaver.model.app.DBPDataSourceRegistry)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 Button (org.eclipse.swt.widgets.Button)8 Group (org.eclipse.swt.widgets.Group)8 Label (org.eclipse.swt.widgets.Label)8 DBPDataSourceFolder (org.jkiss.dbeaver.model.DBPDataSourceFolder)7 Map (java.util.Map)6 Properties (java.util.Properties)6 DriverDescriptor (org.jkiss.dbeaver.registry.driver.DriverDescriptor)6 File (java.io.File)5