Interface Database
- All Superinterfaces:
Database, LocaleFinder
- All Known Implementing Classes:
BasicDatabase, SlaveDatabase
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
-
Field Summary
Fields inherited from interface Database
LUCENE_DIR -
Method Summary
Modifier and TypeMethodDescriptionvoidStart failover for the given database.This method returns the authentication service handle for the database.Return the DataDictionary for this database, set up at boot time.intGet a Resource Adapter - only used by XA system.booleanisActive()Is the database active (open).booleanUsed to indicated whether the database is in the replication slave mode.voidPush a DbContext onto the provided context stack.voidSet the Locale that is returned by this LocaleFindersetupConnection(ContextManager cm, String user, String drdaID, String dbname) Sets up a connection to the Database, owned by the given user.voidstartReplicationMaster(String dbmaster, String host, int port, String replicationMode) Start the replication master role for this databasevoidStop the replication master role for the given database.voidStop the replication slave role for the given database.Methods inherited from interface Database
backup, backupAndEnableLogArchiveMode, checkpoint, disableLogArchiveMode, freeze, getId, getLocale, isReadOnly, unfreezeMethods inherited from interface LocaleFinder
getCurrentLocale, getDateFormat, getTimeFormat, getTimestampFormat
-
Method Details
-
setupConnection
LanguageConnectionContext setupConnection(ContextManager cm, String user, String drdaID, 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 connectiondrdaID- 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
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
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
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
Set the Locale that is returned by this LocaleFinder -
getDataDictionary
DataDictionary getDataDictionary()Return the DataDictionary for this database, set up at boot time. -
failover
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
Stop the replication slave role for the given database.- Throws:
SQLException- Thrown on error
-
startReplicationMaster
void startReplicationMaster(String dbmaster, String host, int port, String replicationMode) throws SQLException Start the replication master role for this database- Parameters:
dbmaster- The master database that is being replicated.host- The hostname for the slaveport- The port the slave is listening onreplicationMode- The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.- Throws:
SQLException- Thrown on error
-
stopReplicationMaster
Stop the replication master role for the given database.- Throws:
SQLException- Thrown on error
-