Class DatabaseUtil
java.lang.Object
org.pentaho.di.core.database.util.DatabaseUtil
- All Implemented Interfaces:
DataSourceProviderInterface
Provides default implementation for looking data sources up in JNDI.
- Author:
- mbatchel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pentaho.di.core.database.DataSourceProviderInterface
DataSourceProviderInterface.DatasourceType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
Clears cache of DataSources (For Unit test)static void
closeSilently
(Connection conn) static void
closeSilently
(Connection[] connections) static void
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.getNamedDataSource
(String datasourceName) Implementation of DatasourceProviderInterface.getNamedDataSource
(String datasourceName, DataSourceProviderInterface.DatasourceType type) Returns the named data source of respecting itstype
invalidateNamedDataSource
(String datasourceName, DataSourceProviderInterface.DatasourceType type) Invalidate the named data source of respecting itstype
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pentaho.di.core.database.DataSourceProviderInterface
getPooledDataSourceFromMeta
-
Constructor Details
-
DatabaseUtil
public DatabaseUtil()
-
-
Method Details
-
clearDSCache
protected static void clearDSCache()Clears cache of DataSources (For Unit test) -
getDataSourceFromJndi
protected static DataSource getDataSourceFromJndi(String dsName, Context ctx) throws NamingException Since JNDI is supported different ways in different app servers, it's nearly impossible to have a ubiquitous way to look up a datasource. This method is intended to hide all the lookups that may be required to find a jndi name.- Parameters:
dsName
- The Datasource name- Returns:
- DataSource if there is one bound in JNDI
- Throws:
NamingException
-
closeSilently
-
closeSilently
-
closeSilently
-
closeSilently
-
getNamedDataSource
Implementation of DatasourceProviderInterface.- Specified by:
getNamedDataSource
in interfaceDataSourceProviderInterface
- Returns:
- javax.sql.DataSource
- Throws:
DataSourceNamingException
-
getNamedDataSource
public DataSource getNamedDataSource(String datasourceName, DataSourceProviderInterface.DatasourceType type) throws DataSourceNamingException Description copied from interface:DataSourceProviderInterface
Returns the named data source of respecting itstype
- Specified by:
getNamedDataSource
in interfaceDataSourceProviderInterface
- Parameters:
datasourceName
- name of the desired data sourcetype
- data source's type- Returns:
- named data source
- Throws:
DataSourceNamingException
-
invalidateNamedDataSource
public DataSource invalidateNamedDataSource(String datasourceName, DataSourceProviderInterface.DatasourceType type) throws DataSourceNamingException Description copied from interface:DataSourceProviderInterface
Invalidate the named data source of respecting itstype
- Specified by:
invalidateNamedDataSource
in interfaceDataSourceProviderInterface
- Parameters:
datasourceName
- name of the desired data sourcetype
- data source's type- Returns:
- named data source
- Throws:
DataSourceNamingException
-