Interface DatasourceManager


public interface DatasourceManager
  • Method Details

    • getConnection

      SRConnection getConnection(String dataSource) throws SQLException
      Retrieves a JDBC new connection for the given named datasource. If the datasource named is currently faulted, the connection may come from its failover datasource, if there is one.

      Throws:
      IllegalArgumentException - if the provided datasource does not exist.
      SQLException
    • getConnection

      SRConnection getConnection(long dataSource) throws SQLException
      Retrieves a JDBC new connection for the datasource with the given id. If the datasource is currently faulted, the connection may come from its failover datasource, if there is one.
      Throws:
      SQLException
    • beginTransaction

      String beginTransaction(String datasource, int isolationLevel, long timeout) throws SQLException
      Begins a transaction against the named datasource.
      Parameters:
      datasource - The name of the datasource to use
      isolationLevel - a constant from java.sql.Connection indicating the new transaction's isolation level.
      timeout - Time to wait between uses of the transaction's connection before it will be automatically rolled back and closed.
      Returns:
      A new transaction ID, which will be used for all further interaction with this transaction.
      Throws:
      SQLException
    • beginTransaction

      void beginTransaction(String id, String datasource, int isolationLevel, long timeout) throws SQLException
      Named queries want to specify their own transaction ID. No return value needed, because we specified ID.
      Parameters:
      id - The transaction ID. Not empty.
      datasource - The name of the datasource to use.
      isolationLevel - a constant from java.sql.Connection indicating the new transaction's isolation level.
      timeout - Time to wait between uses of the transaction's connection before it will be automatically rolled back and closed.
      Throws:
      SQLException
    • commitTransaction

      void commitTransaction(String txId) throws SQLException
      Commits any pending statements for the given transaction.
      Throws:
      SQLException
    • rollbackTransaction

      void rollbackTransaction(String txId) throws SQLException
      Rolls back any statements executed on this transaction since the last commit or since the beginning of the transaction
      Throws:
      SQLException
    • closeTransaction

      void closeTransaction(String txId) throws SQLException
      Closes the given transaction. The transaction ID is no longer valid after this method completes.
      Throws:
      SQLException
    • touchTransaction

      void touchTransaction(String txId)
      Updates the last-used time for the transaction, if it still exists.
    • getTransactionConnection

      SRConnection getTransactionConnection(String txId) throws SQLException
      Returns the connection for a given transaction id.
      Throws:
      SQLException
    • getDatasource

      @Nullable Datasource getDatasource(String name)
      Looks up a datasource by name. Will return null if the datasource doesn't exist
    • getDatasource

      @Nullable Datasource getDatasource(long id)
    • getDatasources

      List<Datasource> getDatasources()
      Returns a list of all known datasources currently installed. This list is not backed by the manager - changes to it will not have any effect.
    • getMetaProvider

      DatasourceMetaProvider getMetaProvider()