/*
(non-Javadoc)

@see com.ibm.websphere.management.j2ee.JDBCResourceMBean#getjdbcDataSources()
974563
@Override
    public String[] getjdbcDataSources() {
        final String methodName = "getjdbcDataSources()";
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(tc, methodName, this);

        final Collection<JDBCDataSourceMBeanImpl> c = dataSourceMBeanChildrenList.values();
        final int size = c.size();
        final String[] result = new String[size];
        int index = 0;
        for (JDBCDataSourceMBeanImpl mbeanItem : c)
            result[index++] = mbeanItem.getobjectName();

        if (trace && tc.isEntryEnabled())
            Tr.exit(tc, methodName, this);
        return result;
        //return dataSourcesList.toArray(new String[dataSourcesList.size()]);
    }
411564
public Collection<String> getActualTableNames(final String targetDataSource) {
        Collection<String> result = new LinkedHashSet<>(actualDataNodes.size());
        for (DataNode each : actualDataNodes) {
            if (targetDataSource.equals(each.getDataSourceName())) {
                result.add(each.getTableName());
            }
        }
        return result;
    }
547129
@Override
    public ResultSet getCatalogs() throws SQLException
    {
        checkClosed();
        VoltTable result = new VoltTable(new VoltTable.ColumnInfo("TABLE_CAT",VoltType.STRING));
        result.addRow(new Object[] { catalogString });
        return new JDBC4ResultSet(null, result);
    }
984426
public java.util.List<DataSource> getDataSources() {
        if (dataSources == null) {
            dataSources = new com.amazonaws.internal.SdkInternalList<DataSource>();
        }
        return dataSources;
    }
1238811
@Override
  public final synchronized DataSource lazyGetDataSource() throws Exception {
    String beanName = getDataSourceName();
    HikariDataSource dataSource =
      (HikariDataSource) getBeansMap().get(beanName);
    if (dataSource == null) {
      dataSource = new HikariDataSource();
      dataSource.setJdbcUrl(getDatabaseName());
      dataSource.setDriverClassName("org.sqlite.JDBC");
      getBeansMap().put(beanName, dataSource);
      lazyGetLogger().info(null, FactoryAppBeansSqlite.class, beanName
        + " has been created.");
    }
    return dataSource;
  }
72205
public java.util.List<DBClusterEndpoint> getDBClusterEndpoints() {
        if (dBClusterEndpoints == null) {
            dBClusterEndpoints = new com.amazonaws.internal.SdkInternalList<DBClusterEndpoint>();
        }
        return dBClusterEndpoints;
    }
200077
@Override
    public final DataSource getJtaDataSource() {
        if (ivJtaDataSource == null || ivJtaDataSource instanceof GenericDataSource) { // d455055
            ivJtaDataSource = getJPADataSource(ivJtaDataSourceJNDIName);
        }
        return ivJtaDataSource;
    }
1062723
public java.util.List<DBClusterSnapshotAttribute> getDBClusterSnapshotAttributes() {
        if (dBClusterSnapshotAttributes == null) {
            dBClusterSnapshotAttributes = new com.amazonaws.internal.SdkInternalList<DBClusterSnapshotAttribute>();
        }
        return dBClusterSnapshotAttributes;
    }
412302
public java.util.List<DBSnapshot> getDBSnapshots() {
        if (dBSnapshots == null) {
            dBSnapshots = new com.amazonaws.internal.SdkInternalList<DBSnapshot>();
        }
        return dBSnapshots;
    }
1040030
static DataSource getDataSource(Object rawDataSource, PageContext pc)
            throws JspException {
	DataSource dataSource = null;

        if (rawDataSource == null) {
            rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
        }

	if (rawDataSource == null) {
	    return null;
	}

        /*
	 * If the 'dataSource' attribute's value resolves to a String
	 * after rtexpr/EL evaluation, use the string as JNDI path to
	 * a DataSource
	 */
        if (rawDataSource instanceof String) {
            try {
                Context ctx = new InitialContext();
                // relative to standard JNDI root for J2EE app
                Context envCtx = (Context) ctx.lookup("java:comp/env");
                dataSource = (DataSource) envCtx.lookup((String) rawDataSource);
            } catch (NamingException ex) {
                dataSource = getDataSource((String) rawDataSource);
            }
        } else if (rawDataSource instanceof DataSource) {
            dataSource = (DataSource) rawDataSource;
        } else {
	    throw new JspException(
                Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
	}

	return dataSource;
    }
908081
@Bean
  public DataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource(dbUrl, userName, password);
    dataSource.setDriverClassName(Driver.class.getName());

    // no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
    // EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    // EmbeddedDatabase dataSource = builder.setType(EmbeddedDatabaseType.H2).setName("h2_example").build();
    return dataSource;
  }
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;
    }
1330723
@Override
	public DataSource createDataSource(String source, Properties configurationProperties, String config) {
		DataSource ds = null;
		try {
			DirectDataSourceConfiguration cfg = new DirectDataSourceConfiguration(configurationProperties);
			ds = new DriverManagerDataSource(cfg.getDriverClassName(), cfg.getUrl(), cfg.getConnectionProperties()); 
		} catch (ClassNotFoundException e) {
			log.error("Driver class not found for '" + source + "' with configuration: " + configurationProperties, e);
		} catch (Exception e) {
			log.error("Error creating data source for '" + source + "' with configuration: " + configurationProperties, e);
		}
		return ds;
	}
641482
public static Database getDatabase(DataSource dataSource) {
		if (dataSource == null) {
			return Database.DEFAULT;
		}
		try {
			String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
			DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url);
			Database database = LOOKUP.get(driver);
			if (database != null) {
				return database;
			}
		}
		catch (MetaDataAccessException ex) {
			logger.warn("Unable to determine jdbc url from datasource", ex);
		}
		return Database.DEFAULT;
	}
642168
@Override
    public Map<String, DataSource> getDataSources() {
        HashMap<String, DataSource> map = new HashMap<>();
        for (Map.Entry<String, HikariDataSource> entry : sources.entrySet()) {
            if (entry.getValue() != null) {
                map.put(entry.getKey(), entry.getValue());
            }
        }
        return map;
    }
1283197
private void initializeDataSource()
   {
      final String jdbcUrl = config.getJdbcUrl();
      final String username = config.getUsername();
      final String password = config.getPassword();
      final String dsClassName = config.getDataSourceClassName();
      final String driverClassName = config.getDriverClassName();
      final String dataSourceJNDI = config.getDataSourceJNDI();
      final Properties dataSourceProperties = config.getDataSourceProperties();

      DataSource ds = config.getDataSource();
      if (dsClassName != null && ds == null) {
         ds = createInstance(dsClassName, DataSource.class);
         PropertyElf.setTargetFromProperties(ds, dataSourceProperties);
      }
      else if (jdbcUrl != null && ds == null) {
         ds = new DriverDataSource(jdbcUrl, driverClassName, dataSourceProperties, username, password);
      }
      else if (dataSourceJNDI != null && ds == null) {
         try {
            InitialContext ic = new InitialContext();
            ds = (DataSource) ic.lookup(dataSourceJNDI);
         } catch (NamingException e) {
            throw new PoolInitializationException(e);
         }
      }

      if (ds != null) {
         setLoginTimeout(ds);
         createNetworkTimeoutExecutor(ds, dsClassName, jdbcUrl);
      }

      this.dataSource = ds;
   }
359487
public java.util.List<DBClusterMember> getDBClusterMembers() {
        if (dBClusterMembers == null) {
            dBClusterMembers = new com.amazonaws.internal.SdkInternalList<DBClusterMember>();
        }
        return dBClusterMembers;
    }