Search in sources :

Example 61 with DBPConnectionConfiguration

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

the class ConnectionPageInitialization method activatePage.

@Override
public void activatePage() {
    if (dataSourceDescriptor != null) {
        if (!activated) {
            // Get settings from data source descriptor
            final DBPConnectionConfiguration conConfig = dataSourceDescriptor.getConnectionConfiguration();
            autocommit.setSelection(dataSourceDescriptor.isDefaultAutoCommit());
            isolationLevel.add("");
            DataSourceDescriptor originalDataSource = getWizard().getOriginalDataSource();
            if (originalDataSource != null && originalDataSource.isConnected()) {
                DBPDataSource dataSource = originalDataSource.getDataSource();
                loadDatabaseSettings(dataSource);
            }
            defaultCatalog.setText(CommonUtils.notEmpty(conConfig.getBootstrap().getDefaultCatalogName()));
            defaultSchema.setText(CommonUtils.notEmpty(conConfig.getBootstrap().getDefaultSchemaName()));
            keepAliveInterval.setSelection(conConfig.getKeepAliveInterval());
            activated = true;
        }
    } else {
        // Default settings
        isolationLevel.setEnabled(false);
        defaultCatalog.setText("");
        defaultSchema.setText("");
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) DataSourceDescriptor(org.jkiss.dbeaver.registry.DataSourceDescriptor)

Example 62 with DBPConnectionConfiguration

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

the class AthenaConnectionPage method loadSettings.

@Override
public void loadSettings() {
    super.loadSettings();
    // Load values from new connection info
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    if (awsRegionCombo != null) {
        awsRegionCombo.removeAll();
        for (AWSRegion region : AWSRegion.values()) {
            awsRegionCombo.add(region.getId());
        }
        if (!CommonUtils.isEmpty(connectionInfo.getServerName())) {
            awsRegionCombo.setText(connectionInfo.getServerName());
        }
        if (awsRegionCombo.getText().isEmpty()) {
            awsRegionCombo.setText(AWSRegion.us_west_1.getId());
        }
    }
    if (s3LocationText != null) {
        String databaseName = connectionInfo.getDatabaseName();
        if (CommonUtils.isEmpty(databaseName)) {
            // $NON-NLS-1$
            databaseName = "s3://";
        }
        s3LocationText.setText(databaseName);
    }
    if (accessKeyText != null) {
        accessKeyText.setText(CommonUtils.notEmpty(connectionInfo.getUserName()));
    }
    if (passwordText != null) {
        passwordText.setText(CommonUtils.notEmpty(connectionInfo.getUserPassword()));
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) AWSRegion(org.jkiss.dbeaver.ext.athena.model.AWSRegion)

Example 63 with DBPConnectionConfiguration

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

the class AthenaConnectionPage method saveSettings.

@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
    DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
    if (awsRegionCombo != null) {
        connectionInfo.setServerName(awsRegionCombo.getText().trim());
    }
    if (s3LocationText != null) {
        connectionInfo.setDatabaseName(s3LocationText.getText().trim());
    }
    if (accessKeyText != null) {
        connectionInfo.setUserName(accessKeyText.getText().trim());
    }
    if (passwordText != null && savePasswordCheck.getSelection()) {
        connectionInfo.setUserPassword(passwordText.getText().trim());
    }
    super.saveSettings(dataSource);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 64 with DBPConnectionConfiguration

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

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 {
            // $NON-NLS-1$
            portText.setText("");
        }
    }
    if (dbText != null) {
        dbText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
    }
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)

Example 65 with DBPConnectionConfiguration

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

the class OracleScriptExecuteHandler method getCommandLine.

@Override
protected List<String> getCommandLine(OracleScriptExecuteSettings settings, OracleDataSource arg) throws IOException {
    List<String> cmd = new ArrayList<>();
    fillProcessParameters(settings, arg, cmd);
    DBPConnectionConfiguration conInfo = settings.getDataSourceContainer().getActualConnectionConfiguration();
    String url;
    if ("TNS".equals(conInfo.getProviderProperty(OracleConstants.PROP_CONNECTION_TYPE))) {
        // $NON-NLS-1$
        url = conInfo.getServerName();
    } else {
        boolean isSID = OracleConnectionType.SID.name().equals(conInfo.getProviderProperty(OracleConstants.PROP_SID_SERVICE));
        String port = conInfo.getHostPort();
        if (isSID) {
            url = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=" + conInfo.getHostName() + ")(Port=" + port + "))(CONNECT_DATA=(SID=" + conInfo.getDatabaseName() + ")))";
        } else {
            // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
            url = "//" + conInfo.getHostName() + (port != null ? ":" + port : "") + "/" + conInfo.getDatabaseName();
        }
    }
    final String role = conInfo.getProviderProperty(OracleConstants.PROP_INTERNAL_LOGON);
    if (role != null) {
        url += (" AS " + role);
    }
    // $NON-NLS-1$ //$NON-NLS-2$
    cmd.add(conInfo.getUserName() + "/" + conInfo.getUserPassword() + "@" + url);
    /*

        if (toolWizard.isVerbose()) {
            cmd.add("-v");
        }
        cmd.add("-q");

        cmd.add(toolWizard.getDatabaseObjects().getName());
*/
    return cmd;
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) ArrayList(java.util.ArrayList)

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