Search in sources :

Example 1 with DBPConnectionConfiguration

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

the class ConnectionPageGeneral method saveSettings.

void saveSettings(DataSourceDescriptor dataSource) {
    if (dataSourceDescriptor != null && !activated) {
        // No changes anyway
        return;
    }
    dataSource.setName(connectionNameText.getText());
    dataSource.setSavePassword(savePasswordCheck.getSelection());
    try {
        dataSource.setDefaultAutoCommit(autocommit.getSelection(), null, true, null);
        if (dataSource.isConnected()) {
            int levelIndex = isolationLevel.getSelectionIndex();
            if (levelIndex <= 0) {
                dataSource.setDefaultTransactionsIsolation(null);
            } else {
                dataSource.setDefaultTransactionsIsolation(supportedLevels.get(levelIndex - 1));
            }
        }
    } catch (DBException e) {
        log.error(e);
    }
    dataSource.setDefaultActiveObject(defaultSchema.getText());
    dataSource.setShowSystemObjects(showSystemObjects.getSelection());
    dataSource.setShowUtilityObjects(showUtilityObjects.getSelection());
    dataSource.setConnectionReadOnly(readOnlyConnection.getSelection());
    if (!dataSource.isSavePassword()) {
        dataSource.resetPassword();
    }
    dataSource.setFolder(dataSourceFolder);
    final DBPConnectionConfiguration confConfig = dataSource.getConnectionConfiguration();
    if (connectionTypeCombo.getSelectionIndex() >= 0) {
        confConfig.setConnectionType(connectionTypeCombo.getItem(connectionTypeCombo.getSelectionIndex()));
    }
    for (FilterInfo filterInfo : filters) {
        if (filterInfo.filter != null) {
            dataSource.setObjectFilter(filterInfo.type, null, filterInfo.filter);
        }
    }
    DBPConnectionBootstrap bootstrap = confConfig.getBootstrap();
    bootstrap.setIgnoreErrors(ignoreBootstrapErrors);
    bootstrap.setInitQueries(bootstrapQueries);
    confConfig.setKeepAliveInterval(keepAliveInterval.getSelection());
    final String description = descriptionText.getText();
    if (description.isEmpty()) {
        dataSource.setDescription(null);
    } else {
        dataSource.setDescription(description);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) DBPConnectionBootstrap(org.jkiss.dbeaver.model.connection.DBPConnectionBootstrap)

Example 2 with DBPConnectionConfiguration

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

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());
    }
    if (usernameText != null) {
        connectionInfo.setUserName(usernameText.getText().trim());
    }
    if (passwordText != null) {
        connectionInfo.setUserPassword(passwordText.getText());
    }
    if (homesSelector != null) {
        connectionInfo.setClientHomeId(homesSelector.getSelectedHome());
    }
    connectionInfo.setProviderProperty(ExasolConstants.DRV_BACKUP_HOST_LIST, backupHostText.getText());
    if (this.encryptCommunication.getSelection())
        connectionInfo.setProviderProperty(ExasolConstants.DRV_ENCRYPT, "1");
    super.saveSettings(dataSource);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 3 with DBPConnectionConfiguration

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

the class MySQLConnectionPage 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());
    }
    if (dbText != null) {
        connectionInfo.setDatabaseName(dbText.getText().trim());
    }
    if (usernameText != null) {
        connectionInfo.setUserName(usernameText.getText().trim());
    }
    if (passwordText != null) {
        connectionInfo.setUserPassword(passwordText.getText());
    }
    if (homesSelector != null) {
        connectionInfo.setClientHomeId(homesSelector.getSelectedHome());
    }
    super.saveSettings(dataSource);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 4 with DBPConnectionConfiguration

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

the class MySQLToolScript method getMySQLToolCommandLine.

public static <BASE_OBJECT extends DBSObject, PROCESS_ARG> List<String> getMySQLToolCommandLine(AbstractToolWizard<BASE_OBJECT, PROCESS_ARG> toolWizard, PROCESS_ARG arg) throws IOException {
    java.util.List<String> cmd = new ArrayList<>();
    toolWizard.fillProcessParameters(cmd, arg);
    if (toolWizard.isVerbose()) {
        cmd.add("-v");
    }
    DBPConnectionConfiguration connectionInfo = toolWizard.getConnectionInfo();
    cmd.add("--host=" + connectionInfo.getHostName());
    if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
        cmd.add("--port=" + connectionInfo.getHostPort());
    }
    cmd.add("-u");
    cmd.add(toolWizard.getToolUserName());
    return cmd;
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) ArrayList(java.util.ArrayList)

Example 5 with DBPConnectionConfiguration

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

the class DB2ConnectionPage method loadSettings.

@Override
public void loadSettings() {
    super.loadSettings();
    // Load values from new connection info
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    if (hostText != null) {
        hostText.setText(CommonUtils.notEmpty(connectionInfo.getHostName()));
    }
    if (portText != null) {
        if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
            portText.setText(String.valueOf(connectionInfo.getHostPort()));
        } else if (site.getDriver().getDefaultPort() != null) {
            portText.setText(site.getDriver().getDefaultPort());
        } else {
            portText.setText("");
        }
    }
    if (dbText != null) {
        dbText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
    }
    if (usernameText != null) {
        usernameText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
    }
    if (passwordText != null) {
        passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
    }
}
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