Init this database and add it to the databaseOwner.
@param databaseOwner My databaseOwner.
@param iDatabaseType The database type (LOCAL/REMOTE).
@param strDBName The database name.
969711
public void init(DatabaseOwner databaseOwner, String strDbName, int iDatabaseType, Map<String, Object> properties)
    {
        super.init(databaseOwner, strDbName, iDatabaseType, properties);

        this.setProperty(DBConstants.READ_ONLY_DB, DBConstants.TRUE);   // This is always read-only
    }
812704
public void init(String tableName, ResultSet columnMetaRs) throws SQLException {
		this.tableName = tableName;

		this.name = columnMetaRs.getString("COLUMN_NAME");
		this.type = columnMetaRs.getInt("DATA_TYPE");
		this.size = columnMetaRs.getInt("COLUMN_SIZE");
		this.isNullable = columnMetaRs.getBoolean("NULLABLE");
		this.comment = columnMetaRs.getString("REMARKS");
	}
161566
public void setupJDBCConnection(String strJdbcDriver) throws DBException
    {
        if (m_JDBCConnection != null)
            return;

        if (firstTime == null)
        	firstTime = new Date();
    	if (m_classDB == null)
    	{
	        synchronized (firstTime)
	        {
	        	if (m_classDB == null)
	        		m_classDB = ClassServiceUtility.getClassService().makeObjectFromClassName(strJdbcDriver);
	        }
    	}
        Utility.getLogger().info("Driver found: " + (m_classDB != null));
        m_JDBCConnection = this.getJDBCConnection();    // Setup the initial connection
    }
1339133
public void addPDatabase(PDatabase pDatabase)
    {
        Object strKey = pDatabase.getDatabaseKey();
        m_htDBList.put(strKey, pDatabase);
    }
455783
public void setDbProperty(String key, String value) {

        // extract the database key out of the entire key
        String databaseKey = key.substring(0, key.indexOf('.'));
        Properties databaseProperties = getDatabaseProperties().get(databaseKey);
        databaseProperties.put(key, value);
    }
596304
public synchronized OServerAdmin createDatabase(final String iDatabaseType, String iStorageMode) throws IOException {
    storage.checkConnection();

    try {
      if (storage.getName() == null || storage.getName().length() <= 0) {
        OLogManager.instance().error(this, "Cannot create unnamed remote storage. Check your syntax", OStorageException.class);
      } else {
        if (iStorageMode == null)
          iStorageMode = "csv";

        final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE);
        try {
          network.writeString(storage.getName());
          if (network.getSrvProtocolVersion() >= 8)
            network.writeString(iDatabaseType);
          network.writeString(iStorageMode);
        } finally {
          storage.endRequest(network);
        }

        storage.getResponse(network);

      }

    } catch (Exception e) {
      OLogManager.instance().error(this, "Cannot create the remote storage: " + storage.getName(), e, OStorageException.class);
      storage.close(true);
    }
    return this;
  }
997967
public void init(BaseDatabase database, Record record)
    {
        super.init(database, record);

        // Call super to set the table property (without calling remote).
        super.setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);
    }
1130831
public void setDBInstances(java.util.Collection<DBInstance> dBInstances) {
        if (dBInstances == null) {
            this.dBInstances = null;
            return;
        }

        this.dBInstances = new java.util.ArrayList<DBInstance>(dBInstances);
    }
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));
    }
252098
public static void setJdbcType(String typeName, int typeIndex, JdbcType type)
    {
        setJdbcTypeByName(typeName, type);
        setJdbcTypeByTypesIndex(typeIndex, type);
    }
640187
private void init_jdbcTypes() throws SQLException
    {
        ReportQuery q = (ReportQuery) getQueryObject().getQuery();
        m_jdbcTypes = new int[m_attributeCount];
        
        // try to get jdbcTypes from Query
        if (q.getJdbcTypes() != null)
        {
            m_jdbcTypes = q.getJdbcTypes();
        }
        else
        {
            ResultSetMetaData rsMetaData = getRsAndStmt().m_rs.getMetaData();
            for (int i = 0; i < m_attributeCount; i++)
            {
                m_jdbcTypes[i] = rsMetaData.getColumnType(i + 1);
            }
            
        }
    }
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);
    }
788708
protected void initializeBatch(String databaseName, String table)
      throws SQLException {
    this.insertStmtPrefix = createInsertStatementStr(databaseName, table);
    this.insertPstmtForFixedBatch =
        this.conn.prepareStatement(createPrepareStatementStr(this.batchSize));
    LOG.info(String.format("Initialized for %s insert " + this, (this.batchSize > 1) ? "batch" : ""));
  }
251424
private void assignDataType(DatabaseType databaseType, DataPersister dataPersister) throws SQLException {
		dataPersister = databaseType.getDataPersister(dataPersister, this);
		this.dataPersister = dataPersister;
		if (dataPersister == null) {
			if (!fieldConfig.isForeign() && !fieldConfig.isForeignCollection()) {
				// may never happen but let's be careful out there
				throw new SQLException("Data persister for field " + this
						+ " is null but the field is not a foreign or foreignCollection");
			}
			return;
		}
		this.fieldConverter = databaseType.getFieldConverter(dataPersister, this);
		if (this.isGeneratedId && !dataPersister.isValidGeneratedType()) {
			StringBuilder sb = new StringBuilder();
			sb.append("Generated-id field '").append(field.getName());
			sb.append("' in ").append(field.getDeclaringClass().getSimpleName());
			sb.append(" can't be type ").append(dataPersister.getSqlType());
			sb.append(".  Must be one of: ");
			for (DataType dataType : DataType.values()) {
				DataPersister persister = dataType.getDataPersister();
				if (persister != null && persister.isValidGeneratedType()) {
					sb.append(dataType).append(' ');
				}
			}
			throw new IllegalArgumentException(sb.toString());
		}
		if (fieldConfig.isThrowIfNull() && !dataPersister.isPrimitive()) {
			throw new SQLException("Field " + field.getName() + " must be a primitive if set with throwIfNull");
		}
		if (this.isId && !dataPersister.isAppropriateId()) {
			throw new SQLException("Field '" + field.getName() + "' is of data type " + dataPersister
					+ " which cannot be the ID field");
		}
		this.dataTypeConfigObj = fieldConverter.makeConfigObject(this);
		String defaultStr = fieldConfig.getDefaultValue();
		if (defaultStr == null) {
			this.defaultValue = null;
		} else if (this.isGeneratedId) {
			throw new SQLException("Field '" + field.getName() + "' cannot be a generatedId and have a default value '"
					+ defaultStr + "'");
		} else {
			this.defaultValue = this.fieldConverter.parseDefaultString(this, defaultStr);
		}
	}
143239
public void addDatabase(Database database)
    {
        if (m_databaseCollection == null)
            m_databaseCollection = new DatabaseCollection(this);
        m_databaseCollection.addDatabase(database);
    }
775384
public void init(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
        for (Entry<TransactionType, ShardingTransactionManager> entry : transactionManagerMap.entrySet()) {
            entry.getValue().init(databaseType, getResourceDataSources(dataSourceMap));
        }
    }
631738
protected final void init() {

        ns = new DINameSpace(database);
        pi = new DIProcedureInfo(ns);

        // flag the Session-dependent cached tables
        Table t;

        for (int i = 0; i < sysTables.length; i++) {
            t = sysTables[i] = generateTable(i);

            if (t != null) {
                t.setDataReadOnly(true);
            }
        }

        GranteeManager gm    = database.getGranteeManager();
        Right          right = new Right();

        right.set(GrantConstants.SELECT, null);

        for (int i = 0; i < sysTableHsqlNames.length; i++) {
            if (sysTables[i] != null) {
                gm.grantSystemToPublic(sysTables[i], right);
            }
        }

        right = Right.fullRights;

        gm.grantSystemToPublic(SqlInvariants.YES_OR_NO, right);
        gm.grantSystemToPublic(SqlInvariants.TIME_STAMP, right);
        gm.grantSystemToPublic(SqlInvariants.CARDINAL_NUMBER, right);
        gm.grantSystemToPublic(SqlInvariants.CHARACTER_DATA, right);
        gm.grantSystemToPublic(SqlInvariants.SQL_CHARACTER, right);
        gm.grantSystemToPublic(SqlInvariants.SQL_IDENTIFIER_CHARSET, right);
        gm.grantSystemToPublic(SqlInvariants.SQL_IDENTIFIER, right);
        gm.grantSystemToPublic(SqlInvariants.SQL_TEXT, right);
    }