Interface Database

  • All Superinterfaces:
    Database, LocaleFinder
    All Known Implementing Classes:
    BasicDatabase, SlaveDatabase

    public interface Database
    extends Database, LocaleFinder
    The org.apache.derby.iapi.db.Database interface provides "internal" methods on the database which are not available to JBMS users (org.apache.derby.database.Database, which this interface extends, provides all the externally visible methods).

    At the present moment, this file defines methods which will at some point be moved to to the external database interface. There are a bunch of the unimplemninted interface that used to be in this file. They have been moved to old_Database.java. old_Database.java is checked into the codeline but is not built, it is there for reference

    • Method Detail

      • setupConnection

        LanguageConnectionContext setupConnection​(ContextManager cm,
                                                  java.lang.String user,
                                                  java.lang.String drdaID,
                                                  java.lang.String dbname)
                                           throws StandardException
        Sets up a connection to the Database, owned by the given user. The JDBC version of getConnection takes a URL. The purpose of the URL is to tell the driver where the database system is. By the time we get here, we have found the database system (that's how we're making this method call), so the URL is not necessary to establish the connection here. The driver should remember the URL that was used to establish the connection, so it can implement the DatabaseMetaData.getURL() method.
        Parameters:
        user - The UserID of the user getting the connection
        drdaID - The drda id of the connection (from network server)
        dbname - The database name
        Returns:
        A new LanguageConnectionContext
        Throws:
        StandardException - thrown if unable to create the connection.
      • pushDbContext

        void pushDbContext​(ContextManager cm)
        Push a DbContext onto the provided context stack. This conext will shut down the database in case of a DatabaseException being cleaned up.
      • isActive

        boolean isActive()
        Is the database active (open).
      • getEngineType

        int getEngineType()
      • getAuthenticationService

        AuthenticationService getAuthenticationService()
                                                throws StandardException
        This method returns the authentication service handle for the database. NOTE: There is always a Authentication Service per database and at the system level.
        Returns:
        The authentication service handle for the database
        Throws:
        StandardException - standard Derby exception policy
      • getResourceAdapter

        java.lang.Object getResourceAdapter()
        Get a Resource Adapter - only used by XA system. There is one and only one resource adapter per Derby database.
        Returns:
        the resource Adapter for the database, null if no resource adapter is available for this database. Returned as an Object so that non-XA aggressive JVMs such as Chai don't get ClassNotFound. caller must cast result to ResourceAdapter.
      • setLocale

        void setLocale​(java.util.Locale locale)
        Set the Locale that is returned by this LocaleFinder
      • getDataDictionary

        DataDictionary getDataDictionary()
        Return the DataDictionary for this database, set up at boot time.
      • failover

        void failover​(java.lang.String dbname)
               throws StandardException
        Start failover for the given database.
        Parameters:
        dbname - the replication database that is being failed over.
        Throws:
        StandardException - 1) If the failover succeeds, an exception is thrown to indicate that the master database was shutdown after a successful failover 2) If a failure occurs during network communication with slave.
      • isInSlaveMode

        boolean isInSlaveMode()
        Used to indicated whether the database is in the replication slave mode.
        Returns:
        true if this database is in replication slave mode, false otherwise.
      • stopReplicationSlave

        void stopReplicationSlave()
                           throws java.sql.SQLException
        Stop the replication slave role for the given database.
        Throws:
        java.sql.SQLException - Thrown on error
      • startReplicationMaster

        void startReplicationMaster​(java.lang.String dbmaster,
                                    java.lang.String host,
                                    int port,
                                    java.lang.String replicationMode)
                             throws java.sql.SQLException
        Start the replication master role for this database
        Parameters:
        dbmaster - The master database that is being replicated.
        host - The hostname for the slave
        port - The port the slave is listening on
        replicationMode - The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.
        Throws:
        java.sql.SQLException - Thrown on error
      • stopReplicationMaster

        void stopReplicationMaster()
                            throws java.sql.SQLException
        Stop the replication master role for the given database.
        Throws:
        java.sql.SQLException - Thrown on error