This method obtains the datasource itself for a caller
@return the DataSource corresponding to the name parameter
199398
public DataSource getDataSource(String dataSourceName) throws
      ServiceLocatorException {
    DataSource dataSource = null;
    try {
      if (cache.containsKey(dataSourceName)) {
        dataSource = (DataSource) cache.get(dataSourceName);
      } else {
        dataSource = (DataSource) ic.lookup(dataSourceName);
        cache.put(dataSourceName, dataSource);
      }
    } catch (NamingException ne) {
      throw new ServiceLocatorException(ne);
    } catch (Exception e) {
      throw new ServiceLocatorException(e);
    }
    return dataSource;
  }
1022037
protected function getDataSource($name)
    {
        return isset($this->dataSources[$name]) ? $this->dataSources[$name] : $this->dataSources['*'];
    }
162123
public String getUrl() {
        final String url = basicJdbcConfiguration.getConfiguredUrl();
        if (calculatedUrl == null || StringUtils.hasText(url)) {
            calculatedUrl = url;
            if (!StringUtils.hasText(calculatedUrl) && embeddedDatabaseConnection.isPresent()) {
                calculatedUrl = embeddedDatabaseConnection.get().getUrl(basicJdbcConfiguration.getName());
            }
            if (!StringUtils.hasText(calculatedUrl)) {
                throw new ConfigurationException(String.format("Error configuring data source '%s'. No URL specified", basicJdbcConfiguration.getName()));
            }
        }

        return calculatedUrl;
    }
202424
public static DataSource createDataSource(String source, String jndiName){
		DataSource ds = createDataSource(source);
		if (ds != null && jndiName != null){
			InitialContext ic;
			try {
				ic = new InitialContext();
				ic.bind(jndiName, ds);
			} catch (NamingException e) {
				log.error("Failed to bind data source '" + source + "' to JNDI name: " + jndiName, e);
			}
		}
		return ds;
	}
91053
public final Connection getConnection(final String dataSourceName) throws SQLException {
        return getConnections(ConnectionMode.MEMORY_STRICTLY, dataSourceName, 1).get(0);
    }
706587
@Override
    public final DataSource getNonJtaDataSource() {
        if (ivNonJtaDataSource == null || ivNonJtaDataSource instanceof GenericDataSource) { // d455055
            ivNonJtaDataSource = getJPADataSource(ivNonJtaDataSourceJNDIName);
        }
        return ivNonJtaDataSource;
    }
1308328
public String getDataset() {
    if (isReference()) {
      final LibrarySet master = (LibrarySet) getCheckedRef(LibrarySet.class, "LibrarySet");
      return master.getDataset();
    }
    return this.dataset;
  }
952477
public static DataSourcePropertyProvider getProvider(final DataSource dataSource) {
        String dataSourceClassName = dataSource.getClass().getName();
        return DATA_SOURCE_PROPERTY_PROVIDERS.containsKey(dataSourceClassName) ? DATA_SOURCE_PROPERTY_PROVIDERS.get(dataSourceClassName) : new DefaultDataSourcePropertyProvider();
    }
1341666
public static @NotNull Database forJndiDataSource(@NotNull String jndiName) {
        return forDataSource(JndiUtils.lookupJndiDataSource(jndiName));
    }
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;
    }
1373253
public function getDatasource()
    {
        $adapter = $this->getAdapter();

        if ($adapter) {
            return $adapter;
        }

        $engine = $this->dsn->engine;

        return 'Database/' . ucfirst($engine);
    }
479654
protected final <T> T createDataSource(Class<T> dataSourceClass) throws SQLException {
		if (getRealDataSourceClassName() == null) {
			throw new SQLException("Property realDataSourceClassName is not set");
		}
		try {
			T ds = dataSourceClass.cast(Class.forName(realDataSourceClassName).newInstance());
			for (Method m : ds.getClass().getMethods()) {
				String methodName = m.getName();
				if (methodName.startsWith("set") && m.getParameterTypes().length == 1) {
					final Object propertyValue;
					if (methodName.equals("setUser")) {
						propertyValue = getUser();
					} else if (methodName.equals("setPassword")) {
						propertyValue = getPassword();
					} else if (methodName.equalsIgnoreCase("setUrl")) {
						propertyValue = getRealUrl();
					} else if (methodName.equals("setLogWriter")) {
						propertyValue = getLogWriter();
					} else if (methodName.equals("setLoginTimeout")) {
						propertyValue = getLoginTimeout();
					} else {
						String propertyName = methodName.substring(3, 4).toLowerCase();
						if (methodName.length() > 4) {
							propertyName += methodName.substring(4);
						}
						final Class<?> propertyType = m.getParameterTypes()[0];
						propertyValue = getPropertyAs(propertyName, propertyType);
					}
					if (propertyValue != null) {
						m.invoke(ds, propertyValue);
					}
				}
			}
			return ds;

		} catch (Exception e) {
			throw new SQLException(e);
		}
	}
928847
public Reference getReference() throws NamingException {

        String    cname = "org.hsqldb_voltpatches.jdbc.JDBCDataSourceFactory";
        Reference ref   = new Reference(getClass().getName(), cname, null);

        ref.add(new StringRefAddr("database", getDatabase()));
        ref.add(new StringRefAddr("user", getUser()));
        ref.add(new StringRefAddr("password", password));

        return ref;
    }
982918
public static String getDataSourceIdentifier(WSJdbcWrapper jdbcWrapper) {
        DSConfig config = jdbcWrapper.dsConfig.get();
        return config.jndiName == null ? config.id : config.jndiName;
    }
1264235
public DataSource createDataSourceProxy(String name, final DataSource dataSource) {
		assert dataSource != null;
		JdbcWrapperHelper.pullDataSourceProperties(name, dataSource);
		final InvocationHandler invocationHandler = new AbstractInvocationHandler<DataSource>(
				dataSource) {
			private static final long serialVersionUID = 1L;

			/** {@inheritDoc} */
			@Override
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				Object result = method.invoke(dataSource, args);
				if (result instanceof Connection) {
					result = createConnectionProxy((Connection) result);
				}
				return result;
			}
		};
		return createProxy(dataSource, invocationHandler);
	}
853271
public DataConnection getConnection() {
        DataConnection connection;

        for (connection = availableConnections.poll();
             connection != null && !connection.isUsable();
             connection = availableConnections.poll())
        {
            if (!connection.isUsable()) {
                connection.close();
            }
        }

        if (connection == null) {
            connection = new DataConnection(getDataUri());

            try {
                connection.connect();
            }
            catch (Exception e) {
                logger.error("[getConnection] could not connect to database", e);
                return null;
            }
        }

        connection.setLocale(threadLocale.getLocale());

        return connection;
    }
14410
public static DataResource fromName(String name)
    {
        String[] parts = StringUtils.split(name, '/');

        if (!parts[0].equals(ROOT_NAME) || parts.length > 3)
            throw new IllegalArgumentException(String.format("%s is not a valid data resource name", name));

        if (parts.length == 1)
            return root();

        if (parts.length == 2)
            return keyspace(parts[1]);

        return columnFamily(parts[1], parts[2]);
    }