Interface IConnectionProvider

  • All Known Implementing Classes:
    DerbyConnectionProvider, DerbyFhirDatabase, JdbcConnectionProvider, PoolConnectionProvider

    public interface IConnectionProvider
    Provides 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. One IConnectionProvider instance 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 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 SQLException
        Commit 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 SQLException
        Roll 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.