Package com.ibm.fhir.database.utils.api
Interface IConnectionProvider
-
- All Known Implementing Classes:
DerbyConnectionProvider,DerbyFhirDatabase,JdbcConnectionProvider,PoolConnectionProvider
public interface IConnectionProviderProvides an abstract way to obtain a JDBC connection. Hides the implementation, making it easier to switch between in-memory instances of Derby used for unit-tests and connections to actual DB2 instances either in pure Java or JEE environments like Liberty Profile. OneIConnectionProviderinstance is used per data source. If you need to connect to more than one database, you'll need multiple providers. This is just simple wrapper stuff...allowing us to switch out underlying pool implementations should we want/need to. No support for distributed transactions or anything fancy like that.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcommitTransaction()Commit the current transaction if there's an actual connection associated with this thread (i.e.voiddescribe(String prefix, StringBuilder cfg, String key)Describe self, for writing configuration information to log file for test record purposesConnectiongetConnection()Obtain a new connection to a data-source which this provider has been configured for.default intgetPoolSize()used to control threading size.IDatabaseTranslatorgetTranslator()Get the translator associated with this connection provider.voidrollbackTransaction()Roll back the transaction for the connection associated with this thread, if one exists
-
-
-
Method Detail
-
getConnection
Connection getConnection() throws SQLException
Obtain a new connection to a data-source which this provider has been configured for.- Returns:
- Throws:
SQLException
-
getTranslator
IDatabaseTranslator getTranslator()
Get the translator associated with this connection provider. Supports interpretation of SQLExceptions and the ability to tweak SQL statements to handle differences between DB2 and Derby- Returns:
-
commitTransaction
void commitTransaction() throws SQLExceptionCommit the current transaction if there's an actual connection associated with this thread (i.e. if getConnection() has been called at least once), otherwise do nothing.- Throws:
SQLException
-
rollbackTransaction
void rollbackTransaction() throws SQLExceptionRoll back the transaction for the connection associated with this thread, if one exists- Throws:
SQLException
-
describe
void describe(String prefix, StringBuilder cfg, String key)
Describe self, for writing configuration information to log file for test record purposes- Parameters:
cfg-key-
-
getPoolSize
default int getPoolSize()
used to control threading size.
-
-