public class DatabaseUtil extends Object implements DataSourceProviderInterface
DataSourceProviderInterface.DatasourceType| Constructor and Description |
|---|
DatabaseUtil() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
clearDSCache()
Clears cache of DataSources (For Unit test)
|
static void |
closeSilently(Connection conn) |
static void |
closeSilently(Connection[] connections) |
static void |
closeSilently(Statement st) |
static void |
closeSilently(Statement[] statements) |
protected static DataSource |
getDataSourceFromJndi(String dsName,
Context ctx)
Since JNDI is supported different ways in different app servers, it's nearly impossible to have a ubiquitous way to
look up a datasource.
|
DataSource |
getNamedDataSource(String datasourceName)
Implementation of DatasourceProviderInterface.
|
DataSource |
getNamedDataSource(String datasourceName,
DataSourceProviderInterface.DatasourceType type)
Returns the named data source of respecting its
type |
protected static void clearDSCache()
protected static DataSource getDataSourceFromJndi(String dsName, Context ctx) throws NamingException
dsName - The Datasource nameNamingExceptionpublic static void closeSilently(Connection[] connections)
public static void closeSilently(Connection conn)
public static void closeSilently(Statement[] statements)
public static void closeSilently(Statement st)
public DataSource getNamedDataSource(String datasourceName) throws DataSourceNamingException
getNamedDataSource in interface DataSourceProviderInterfaceDataSourceNamingExceptionpublic DataSource getNamedDataSource(String datasourceName, DataSourceProviderInterface.DatasourceType type) throws DataSourceNamingException
DataSourceProviderInterfacetypegetNamedDataSource in interface DataSourceProviderInterfacedatasourceName - name of the desired data sourcetype - data source's typeDataSourceNamingExceptionCopyright © 2020 Hitachi Vantara. All rights reserved.