use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class WMIDataSourceProvider method openDataSource.
@NotNull
@Override
public DBPDataSource openDataSource(@NotNull DBRProgressMonitor monitor, @NotNull DBPDataSourceContainer container) throws DBException {
if (!libLoaded) {
DBPDriver driver = container.getDriver();
driver.loadDriver(monitor);
loadNativeLib(driver);
libLoaded = true;
}
return new WMIDataSource(container);
}
use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class DataTypeProviderRegistry method findTransformers.
@Override
public List<AttributeTransformerDescriptor> findTransformers(DBPDataSource dataSource, DBSTypedObject typedObject, Boolean custom) {
DBPDriver driver = dataSource.getContainer().getDriver();
if (!(driver instanceof DriverDescriptor)) {
log.warn("Bad datasource specified (driver is not recognized by registry) - " + dataSource);
return null;
}
DataSourceProviderDescriptor dsProvider = ((DriverDescriptor) driver).getProviderDescriptor();
// Find in default providers
List<AttributeTransformerDescriptor> result = null;
for (AttributeTransformerDescriptor descriptor : dataTypeTransformers) {
if ((custom == null || custom == descriptor.isCustom()) && ((!descriptor.isGlobal() && descriptor.supportsDataSource(dataSource, dsProvider) && descriptor.supportsType(typedObject)) || (descriptor.isGlobal() && descriptor.supportsType(typedObject)))) {
if (result == null) {
result = new ArrayList<>();
}
result.add(descriptor);
}
}
return result;
}
use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class ConfigImportWizardPageCustomConnections method loadConnections.
@Override
protected void loadConnections(ImportData importData) throws DBException {
setErrorMessage(null);
ConfigImportWizardCustom wizard = (ConfigImportWizardCustom) getWizard();
final DBPDriver driver = wizard.getDriver();
ImportDriverInfo driverInfo = new ImportDriverInfo(driver.getId(), driver.getName(), driver.getSampleURL(), driver.getDriverClassName());
importData.addDriver(driverInfo);
File inputFile = wizard.getInputFile();
try (InputStream is = new FileInputStream(inputFile)) {
try (Reader reader = new InputStreamReader(is, wizard.getInputFileEncoding())) {
if (wizard.getImportType() == ConfigImportWizardCustom.ImportType.CSV) {
importCSV(importData, driverInfo, reader);
} else {
importXML(importData, driverInfo, reader);
}
}
} catch (Exception e) {
setErrorMessage(e.getMessage());
}
}
use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class MySQLConnectionPage method loadSettings.
@Override
public void loadSettings() {
super.loadSettings();
DBPDriver driver = getSite().getDriver();
if (!activated) {
// There is a bug in Eclipse which leads to SWTException after wizard image change
if (driver != null && driver.getId().equalsIgnoreCase(MySQLConstants.DRIVER_ID_MARIA_DB)) {
setImageDescriptor(MARIADB_LOGO_IMG);
} else {
setImageDescriptor(MYSQL_LOGO_IMG);
}
}
// Load values from new connection info
DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
if (hostText != null) {
if (!CommonUtils.isEmpty(connectionInfo.getHostName())) {
hostText.setText(connectionInfo.getHostName());
} else {
hostText.setText(MySQLConstants.DEFAULT_HOST);
}
}
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()));
}
homesSelector.populateHomes(site.getDriver(), connectionInfo.getClientHomeId());
activated = true;
}
use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class GenericSQLDialect method initDriverSettings.
public void initDriverSettings(JDBCDataSource dataSource, JDBCDatabaseMetaData metaData) {
super.initDriverSettings(dataSource, metaData);
DBPDriver driver = dataSource.getContainer().getDriver();
this.scriptDelimiter = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_SCRIPT_DELIMITER));
this.scriptDelimiterRedefiner = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_SCRIPT_DELIMITER_REDEFINER));
this.legacySQLDialect = CommonUtils.toBoolean(driver.getDriverParameter(GenericConstants.PARAM_LEGACY_DIALECT));
this.suportsUpsert = ((GenericDataSource) dataSource).getMetaModel().supportsUpsertStatement();
if (this.suportsUpsert) {
addSQLKeyword("UPSERT");
}
this.quoteReservedWords = CommonUtils.getBoolean(driver.getDriverParameter(GenericConstants.PARAM_QUOTE_RESERVED_WORDS), true);
this.testSQL = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_QUERY_PING));
if (CommonUtils.isEmpty(this.testSQL)) {
this.testSQL = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_QUERY_GET_ACTIVE_DB));
}
this.dualTable = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_DUAL_TABLE));
if (this.dualTable.isEmpty()) {
this.dualTable = null;
}
}
Aggregations