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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidClears cache of DataSources (For Unit test)static voidcloseSilently(Connection conn) static voidcloseSilently(Connection[] connections) static voidstatic voidcloseSilently(Statement[] statements) protected static DataSourcegetDataSourceFromJndi(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 itstypeinvalidateNamedDataSource(String datasourceName, DataSourceProviderInterface.DatasourceType type) Invalidate the named data source of respecting itstypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getNamedDataSourcein interfaceDataSourceProviderInterface- Returns:
- javax.sql.DataSource
- Throws:
DataSourceNamingException
-
getNamedDataSource
public DataSource getNamedDataSource(String datasourceName, DataSourceProviderInterface.DatasourceType type) throws DataSourceNamingException Description copied from interface:DataSourceProviderInterfaceReturns the named data source of respecting itstype- Specified by:
getNamedDataSourcein 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:DataSourceProviderInterfaceInvalidate the named data source of respecting itstype- Specified by:
invalidateNamedDataSourcein interfaceDataSourceProviderInterface- Parameters:
datasourceName- name of the desired data sourcetype- data source's type- Returns:
- named data source
- Throws:
DataSourceNamingException
-