Get the (optional) raw data database manager.
Note: This is only used in thin, in the thick model, pDatabaseOwner is in Environment.
@return The pDatabaseOwner (returns an object, so this package isn't dependent on PDatabaseOwner).
763990
public ThinPhysicalDatabaseParent getPDatabaseParent(Map<String,Object> properties, boolean bCreateIfNew)
    {
        if (m_PhysicalDatabaseParent == null)
            if (bCreateIfNew)
        {
            Map<String,Object> map = new Hashtable<String,Object>();
            if (properties != null)
                map.putAll(properties);
            if (map.get(PhysicalDatabaseParent.APP) == null)
                map.put(PhysicalDatabaseParent.APP, this); // Access to the server, etc.
            
            m_PhysicalDatabaseParent = (ThinPhysicalDatabaseParent)ClassServiceUtility.getClassService().makeObjectFromClassName(Constants.ROOT_PACKAGE + "thin.base.db.mem.base.PhysicalDatabaseParent");
            if (m_PhysicalDatabaseParent != null)
                m_PhysicalDatabaseParent.init(map);  // Init
        }
        if (properties != null)
        {
            for (String strKey : properties.keySet())
            {
                m_PhysicalDatabaseParent.setProperty(strKey, properties.get(strKey));
            }
        }
        return m_PhysicalDatabaseParent;
    }
467909
@Override
   public synchronized TransactionManager getTransactionManager() {
      if (!lookupDone) {
         doLookups(globalCfg.classLoader());
      }
      if (tm != null)
         return tm;
      if (lookupFailed) {
         if (!noJBossTM) {
            // First try an embedded JBossTM/Wildly instance
            tryEmbeddedJBossTM();
         }

         if (noJBossTM) {
            //fall back to a dummy from Infinispan
            useDummyTM();
         }
      }
      return tm;
   }
475576
public static function &_getDbMaster ()
	{
		
		// Get the default master
		
		$obj	=& self::_getResource ('db-master');
		
		// Failing that try to get a random master
		
		if (!$obj)
		{
			
			$obj	=& self::_getRandomDbResource ('db-master');
			
			// Default to database resource if no valid master
		
			if (!$obj)
			{
				$obj =& self::_getResource ('db');
			}
			
		}
		
		// Return database connection
		
		return $obj;
		
	}
23138
public static synchronized ITangoDB getDatabase() throws DevFailed {
        ITangoDB tangoDb = null;
        if (useDb) {
            final String tangoHost = TangoHostManager.getFirstTangoHost();
            // Search if database object already created for this host and port
            if (databaseMap.containsKey(tangoHost)) {
                tangoDb = databaseMap.get(tangoHost);
            } else {
                // Else, create a new database object
                DevFailed lastError = null;
                // try all tango hosts until connection is established
                final Map<String, String> tangoHostMap = TangoHostManager.getTangoHostPortMap();
                for (final Entry<String, String> entry : tangoHostMap.entrySet()) {
                    try {
                        lastError = null;
                        tangoDb = new Database(entry.getKey(), entry.getValue());
                        databaseMap.put(tangoHost, tangoDb);
                        break;
                    } catch (final DevFailed e) {
                        lastError = e;
                    }
                }
                if (lastError != null) {
                    throw lastError;
                }
            }
        } else {
            tangoDb = fileDatabase;
        }
        return tangoDb;
    }
640825
private RDBMetadata extractDBMetadata(SQLPPMapping ppMapping, Optional<RDBMetadata> optionalDBMetadata,
                                          OBDASpecInput specInput)
            throws DBMetadataExtractionException {

        boolean isDBMetadataProvided = optionalDBMetadata.isPresent();

        /*
         * Metadata extraction can be disabled when DBMetadata is already provided
         */
        if (isDBMetadataProvided && (!settings.isProvidedDBMetadataCompletionEnabled()))
            return optionalDBMetadata.get();

        try (Connection localConnection = LocalJDBCConnectionUtils.createConnection(settings)) {
            return isDBMetadataProvided
                    ? dbMetadataExtractor.extract(ppMapping, localConnection, optionalDBMetadata.get(),
                    specInput.getConstraintFile())
                    : dbMetadataExtractor.extract(ppMapping, localConnection, specInput.getConstraintFile());
        }
        /*
         * Problem while creating the connection
         */
        catch (SQLException e) {
            throw new DBMetadataExtractionException(e.getMessage());
        }
    }
870056
public DBService getDefaultDB() {
        String defaultTenantName = TenantService.instance().getDefaultTenantName();
        synchronized (m_tenantDBMap) {
            DBService dbservice = m_tenantDBMap.get(defaultTenantName);
            assert dbservice != null : "Database for default tenant not found";
            return dbservice;
        }
    }
604859
@POST
    @Path("getDatabaseProductName")    
	public String getDatabaseProductName(String id) throws SQLException {
		return DatabaseMetaDataHolder.get().get(id).getDatabaseProductName();
	}
63339
public function getDataMapper()
    {
        if (!$this->mapper) {
            $this->mapper = new DataMapper($this->table, $this->keys);
        }

        return $this->mapper;
    }
365195
private String getDatabaseProductName(WSDataSource dataSource) throws Exception {
        String dbProductName = dataSource.getDatabaseProductName();
        if (dbProductName == null) {
            // Query the metadata under a new transaction and commit right away
            LocalTransactionCurrent localTranCurrent = this.localTranCurrent;
            LocalTransactionCoordinator suspendedLTC = localTranCurrent.suspend();
            EmbeddableWebSphereTransactionManager tranMgr = this.tranMgr;
            Transaction suspendedTran = suspendedLTC == null ? tranMgr.suspend() : null;
            boolean tranStarted = false;
            try {
                tranMgr.begin();
                tranStarted = true;
                Connection con = dataSource.getConnection();
                try {
                    dbProductName = con.getMetaData().getDatabaseProductName();
                } finally {
                    con.close();
                }
            } finally {
                try {
                    if (tranStarted)
                        tranMgr.commit();
                } finally {
                    // resume
                    if (suspendedTran != null)
                        tranMgr.resume(suspendedTran);
                    else if (suspendedLTC != null)
                        localTranCurrent.resume(suspendedLTC);
                }
            }
        }
        return dbProductName;
    }
637493
Connection getDataSourceConnection() {
        Connection connection = null;
        try {
            connection = dataSource.getConnection();
        } catch (SQLException ex) {
            throw new InitializationException("Could not obtain the db connection: Cannot get connection", ex);
        }
        return connection;
    }
953924
public static Optional<EmbeddedJdbcDatabase> get(ClassLoader classLoader) {
        return databases
            .stream()
            .filter(JdbcDatabase::isEmbedded)
            .map(EmbeddedJdbcDatabase.class::cast)
            .filter(embeddedDatabase -> ClassUtils.isPresent(embeddedDatabase.getDriverClassName(), classLoader))
            .findFirst();
    }
999414
public String getDatabaseName()
    {
        // ****Override this****, If not, try to figure it out
        if (m_vRecordList != null)
            if (this.getRecordlistAt(0) != null)
                return this.getRecordlistAt(0).getDatabaseName();
        return DBConstants.BLANK; // Blank
    }
285971
public Database getDatabase(String strDBName, int iDatabaseType, Map<String, Object> properties)
    {
        if ((strDBName == null) || (strDBName.length() == 0))
            return null;
        Database database = this.getDatabaseList(iDatabaseType).get(strDBName);
        if (database == null)
        {
            if ((properties != null)
            	&& (DBConstants.FALSE.equals(properties.get(DBConstants.CREATE_DB_IF_NOT_FOUND)))
            	&& (Environment.DATABASE_DOESNT_EXIST == ((Environment)m_databaseOwner.getEnvironment()).getCachedDatabaseProperties(strDBName)))
            		return null;	// Hey, if the database doesn't exist, don't try again.
            if (iDatabaseType != DBConstants.SCREEN)
                database = this.makeDatabase(iDatabaseType);    // BaseDatabase not found, open it!
            else
                database = new BaseDatabase();                  // Special case: A screen database
            if (database != null)
                database.init(m_databaseOwner, strDBName, iDatabaseType & DBConstants.TABLE_MASK, properties); // init it!
            if (database != null)
            {
                try   {
                    ((BaseDatabase)database).open();    // open it!
                } catch (DBException ex) {
                    database.free();
                    database = null;    // Failure on db open
                    if ((ex.getErrorCode() == DBConstants.DB_NOT_FOUND)
                		&& (properties != null)
                        && (DBConstants.FALSE.equals(properties.get(DBConstants.CREATE_DB_IF_NOT_FOUND))))
                    {	// If the db doesn't exist, cache the name so I won't try this (expensive) operation again
                        ((Environment)m_databaseOwner.getEnvironment()).cacheDatabaseProperties(strDBName, Environment.DATABASE_DOESNT_EXIST);
                    }
                }
            }
        }
        return database;
    }
1243767
public function getEntityManager()
    {

        // check if we have a valid datasource node
        if ($this->getDatasourceNode() == null) {
            return;
        }

        // prepare the path to the entities
        $absolutePaths = array();
        if ($relativePaths = $this->getStepNode()->getParam(AbstractDatabaseStep::PARAM_PATH_TO_ENTITIES)) {
            foreach (explode(PATH_SEPARATOR, $relativePaths) as $relativePath) {
                $absolutePaths[] = $this->getWebappPath() . DIRECTORY_SEPARATOR . $relativePath;
            }
        }

        // load the database connection parameters
        $connectionParameters = $this->getConnectionParameters();

        // initialize and load the entity manager and the schema tool
        $metadataConfiguration = Setup::createAnnotationMetadataConfiguration($absolutePaths, true, null, null, false);
        return EntityManager::create($connectionParameters, $metadataConfiguration);
    }
40508
public T get() {
		final SQLiteDatabase db = Sprinkles.getDatabase();
		final Cursor c = db.rawQuery(rawQuery, null);

		T result = null;
		if (c.moveToFirst()) {
			result = Utils.getResultFromCursor(resultClass, c);
		}

		c.close();
		return result;
	}
892135
private TransactionManager getTransactionManager()
    {
        TransactionManager retval = null;
        try
        {
            if (log.isDebugEnabled()) log.debug("getTransactionManager called");
            retval = TransactionManagerFactoryFactory.instance().getTransactionManager();
        }
        catch (TransactionManagerFactoryException e)
        {
            log.warn("Exception trying to obtain TransactionManager from Factory", e);
            e.printStackTrace();
        }
        return retval;
    }
687861
public String getFullDatabaseKey() {

        if (m_fullDatabaseKey == null) {
            m_fullDatabaseKey = getExtProperty("db.name") + "_sql";
        }
        if (CmsStringUtil.isEmpty(m_fullDatabaseKey) || m_fullDatabaseKey.equals("_sql")) {
            m_fullDatabaseKey = getSortedDatabases().get(0) + "_sql";
        }
        return m_fullDatabaseKey;
    }