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);
}
}
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);
}
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);
}
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;
}
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()));
}
}
Aggregations