Init this database and add it to the databaseOwner.
@param databaseOwner My databaseOwner.
@param iDatabaseType The database type (LOCAL/REMOTE).
@param properties Initial database properties
@param strDBName The database name.
355802
public void init(DatabaseOwner databaseOwner, String strDbName, int iDatabaseType, Map<String, Object> properties)
    {
        m_databaseOwner = databaseOwner;
        m_strDbName = strDbName;
        m_iDatabaseType = iDatabaseType;
        m_vTableList = new Vector<BaseTable>();
        m_iMasterSlave = RecordOwner.MASTER | RecordOwner.SLAVE;
        m_bAutosequenceSupport = true;
        if (m_properties == null)
            m_properties = new Hashtable<String,Object>();
        if (properties != null)
        	m_properties.putAll(properties);

        m_databaseOwner.addDatabase(this);
    }
986593
@Override
  public final void changeDatabase(final String pDbName) throws Exception {
    String dbNm = this.databasePrefix + pDbName + ".sqlite";
    synchronized (this.factoryAppBeans) {
      if (!this.factoryAppBeans.getDatabaseName().equals(dbNm)) {
        this.factoryAppBeans.setDatabaseName(dbNm);
        this.factoryAppBeans.handleDatabaseChanged();
      }
    }
  }
1313350
function registerDatabaseType($typeIdentifier, \Plasma\Types\TypeExtensionInterface $type): void {
        if(isset($this->dbTypes[$typeIdentifier])) {
            throw new \Plasma\Exception('Database Type identifier is already in use');
        }
        
        $this->dbTypes[$typeIdentifier] = $type;
    }
962915
static void initializeDatabaseDriver(String databaseType) {
    String driverClass = System.getProperty(JDBC_DRIVER_CLASS_KEY_PREFIX + databaseType);
    if (driverClass != null) {
      Log.debug("Loading " + driverClass + " to initialize database of type " + databaseType);
      try {
        Class.forName(driverClass);
      } catch (ClassNotFoundException e) {
        throw new RuntimeException("Connection to '" + databaseType + "' database is not possible due to missing JDBC driver. " +
                "User specified driver class: " + driverClass, e);
      }
      return;
    }
    // use built-in defaults
    switch (databaseType) {
      case HIVE_DB_TYPE:
        try {
          Class.forName(HIVE_JDBC_DRIVER_CLASS);
        } catch (ClassNotFoundException e) {
          throw new RuntimeException("Connection to HIVE database is not possible due to missing JDBC driver.", e);
        }
        break;
      case NETEZZA_DB_TYPE:
        try {
          Class.forName(NETEZZA_JDBC_DRIVER_CLASS);
        } catch (ClassNotFoundException e) {
          throw new RuntimeException("Connection to Netezza database is not possible due to missing JDBC driver.", e);
        }
        break;
      default:
        //nothing to do
    }
  }
1224763
public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) {
        for (DatabaseProtocolFrontendEngine each : NewInstanceServiceLoader.newServiceInstances(DatabaseProtocolFrontendEngine.class)) {
            if (DatabaseType.valueFrom(each.getDatabaseType()) == databaseType) {
                return each;
            }
        }
        throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType));
    }
295812
private LinkDatabase makeLinkDatabase(Properties props) {
    String dbtype = get(props, "duke.linkdbtype");
    if (dbtype.equals("jdbc"))
      return makeJDBCLinkDatabase(props);
    else if (dbtype.equals("jndi"))
      return makeJNDILinkDatabase(props);
    else
      throw new DukeConfigException("Unknown link database type '" + dbtype +
                                    "'");
  }
885000
public void addDatabaseProperty(String strKey, String strValue)
    {
        this.setProperty(strKey, strValue);
        Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
        if (env.getCachedDatabaseProperties(this.getDatabaseName(true)) != null)  // Always
            if (env.getCachedDatabaseProperties(this.getDatabaseName(true)) != Environment.DATABASE_DOESNT_EXIST)  // Always
                env.getCachedDatabaseProperties(this.getDatabaseName(true)).put(strKey, strValue);
    }
835144
public Map<String, Object> addDatabaseProperties(Map<String,Object> properties, DatabaseOwner databaseOwner)
    {
        Map<String,Object> oldProperties = databaseOwner.getProperties();
        if (properties != null)
        {   // Also move any application params up.
            for (String key : properties.keySet())
            {   // Move these params to the application
                if ((key.endsWith(BaseDatabase.DBSHARED_PARAM_SUFFIX))
            		|| (key.endsWith(BaseDatabase.DBUSER_PARAM_SUFFIX))
                    || (DBConstants.DB_USER_PREFIX.equals(key))
                        || (DBConstants.SYSTEM_NAME.equals(key)))
                {
                    if (oldProperties == databaseOwner.getProperties())
                    {   // Return the old properties
                        oldProperties = new HashMap<String,Object>();
                        oldProperties.putAll(databaseOwner.getProperties());
                    }
                    databaseOwner.setProperty(key, (String)properties.get(key));
                }
            }
        }
        return oldProperties;
    }
1292750
static <T> void validateTenantConfigurationDataType(final TenantConfigurationKey configurationKey,
            final Class<T> propertyType) {

        if (!configurationKey.getDataType().isAssignableFrom(propertyType)) {
            throw new TenantConfigurationValidatorException(
                    String.format("Cannot parse the database value of type %s into the type %s.",
                            configurationKey.getDataType(), propertyType));
        }
    }
451361
function IDBDatabase(db, name, version, storeProperties){
        this.__db = db;
        this.__closed = false;
        this.version = version;
        this.name = name;
        this.onabort = this.onerror = this.onversionchange = null;

        this.__objectStores = {};
        this.objectStoreNames = new idbModules.util.StringList();
        for (var i = 0; i < storeProperties.rows.length; i++) {
            var store = new idbModules.IDBObjectStore(storeProperties.rows.item(i));
            this.__objectStores[store.name] = store;
            this.objectStoreNames.push(store.name);
        }
    }
463971
@Override
   public DatabaseDataType toDatabaseDataType(final Database database) {
      final DatabaseDataType databaseDataType;
      if (database instanceof DerbyDatabase) {
         databaseDataType = new DatabaseDataType("VARCHAR(32672) FOR BIT DATA");
      } else if (database instanceof H2Database) {
         // User's wanting to use a BLOB can use modifySql.
         databaseDataType = new DatabaseDataType("BINARY");
      } else if (database instanceof OracleDatabase) {
         databaseDataType = new DatabaseDataType("SDO_GEOMETRY");
      } else if (database instanceof PostgresDatabase) {
         databaseDataType = new DatabaseDataType(getName(), getParameters());
      } else {
         databaseDataType = new DatabaseDataType("GEOMETRY");
      }
      return databaseDataType;
   }
33126
private PropertyOperations addPropertiesFromDatabase(PropertyOperations sourceProperties) {
        PropertyOperations dbPropsOnly = sourceProperties.filterByKeyPrefix(ChorusConstants.DATABASE_CONFIGS_PROPERTY_GROUP + ".")
                                                         .removeKeyPrefix(ChorusConstants.DATABASE_CONFIGS_PROPERTY_GROUP + ".");
        dbPropsOnly = VariableExpandingPropertyLoader.expandVariables(dbPropsOnly, currentFeature);
        Map<String, Properties> dbPropsByDbName = dbPropsOnly.splitKeyAndGroup("\\.").loadPropertyGroups();
        PropertyOperations o = sourceProperties;
        for ( Map.Entry<String, Properties> m : dbPropsByDbName.entrySet()) {
            log.debug("Creating loader for database properties " + m.getKey());

            //current properties which may be from properties files or classpath take precedence over db properties so merge them on top
            o = properties(new JdbcPropertyLoader(m.getValue())).merge(o);
        }
        return o;
    }
538924
protected void initDatabase() throws NamingException, RepositoryException, IOException
   {
      DBInitializer dbInitializer = null;
      if (containerConfig.dbDialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
      {
         LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");

         this.connFactory = defaultConnectionFactory();
         dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new PgSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
      {
         if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL_MYISAM))
         {
            LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
               + " if you don't expect any support and performances in read accesses are more important than the consistency"
               + " in your use-case. This dialect is only dedicated to the community.");
         }
         this.connFactory = new MySQLConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new MysqlDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
      {
         this.connFactory = new MSSQLConnectionFactory(getDataSource(), containerConfig);
         dbInitializer=new MSSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = defaultDBInitializer();
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new DB2DBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
      {
         this.connFactory = new SybaseConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new SybaseDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new IngresSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
      {
         this.connFactory = new HSQLDBConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new HSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else
      {
         // generic, DB_HSQLDB
         this.connFactory = defaultConnectionFactory();
         dbInitializer = defaultDBInitializer();
      }

      // database type
      try
      {
         dbInitializer.init();
      }
      catch (DBInitializerException e)
      {
         LOG.error("Error of init db " + e, e);
      }
   }
483239
public void init(PhysicalDatabaseParent pDatabaseOwner, String strDbName, char charPDatabaseType)
    {
        m_htTableList = new Hashtable<Object,PTable>();
        m_strDBName = strDbName;
        m_charPDatabaseType = charPDatabaseType;
        this.setPDatabaseParent(pDatabaseOwner);
    }
665567
public void init(BaseDatabase database, Record record)
    {
        super.init(database, record);

        if (database != null)
            if ((database.getDatabaseType() & Constants.REMOTE_MEMORY) == 0)
                this.setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);   // Since there is no remote copy
    }
1005321
public void setAttributePropertiesInDB(final String attributeName, final Map<String, String[]> properties)
            throws DevFailed {
        xlogger.entry(properties);

        final Map<String, String> currentValues = getAttributePropertiesFromDBSingle(attributeName);
        final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        for (final Entry<String, String[]> entry : properties.entrySet()) {
            final String propertyName = entry.getKey();
            final String[] valueArray = entry.getValue();
            // insert value in db only if input value is different and not a
            // default value
            if (valueArray.length == 1) {
                final String value = valueArray[0];
                final String presentValue = currentValues.get(propertyName);
                boolean isADefaultValue = false;
                if (presentValue != null) {
                    isADefaultValue = presentValue.isEmpty()
                            && (value.equalsIgnoreCase(Constants.NOT_SPECIFIED)
                                    || value.equalsIgnoreCase(Constants.NO_DIPLAY_UNIT)
                                    || value.equalsIgnoreCase(Constants.NO_UNIT) || value
                                        .equalsIgnoreCase(Constants.NO_STD_UNIT));
                }
                if (!isADefaultValue) {
                    if (presentValue == null) {
                        propInsert.put(propertyName, valueArray);
                    } else if (!presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) {
                        propInsert.put(propertyName, valueArray);
                    }
                }
            } else {
                // do not check if not a single value
                propInsert.put(propertyName, valueArray);
            }
        }
        logger.debug("update attribute {} properties {} in DB ", attributeName, properties.keySet());
        DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        xlogger.exit();
    }
603436
public void init(BaseDatabase database, Record record)
    {
        m_pTable = null;
        super.init(database, record);
        m_pTable = ((PhysicalDatabase)database).getPDatabase().getPTable(record, true);
        m_pTable.addPTableOwner(this);
    }