Package org.apache.derby.iapi.db
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
-
-
Field Summary
-
Fields inherited from interface org.apache.derby.database.Database
LUCENE_DIR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
failover(java.lang.String dbname)
Start failover for the given database.AuthenticationService
getAuthenticationService()
This method returns the authentication service handle for the database.DataDictionary
getDataDictionary()
Return the DataDictionary for this database, set up at boot time.int
getEngineType()
java.lang.Object
getResourceAdapter()
Get a Resource Adapter - only used by XA system.boolean
isActive()
Is the database active (open).boolean
isInSlaveMode()
Used to indicated whether the database is in the replication slave mode.void
pushDbContext(ContextManager cm)
Push a DbContext onto the provided context stack.void
setLocale(java.util.Locale locale)
Set the Locale that is returned by this LocaleFinderLanguageConnectionContext
setupConnection(ContextManager cm, java.lang.String user, java.lang.String drdaID, java.lang.String dbname)
Sets up a connection to the Database, owned by the given user.void
startReplicationMaster(java.lang.String dbmaster, java.lang.String host, int port, java.lang.String replicationMode)
Start the replication master role for this databasevoid
stopReplicationMaster()
Stop the replication master role for the given database.void
stopReplicationSlave()
Stop the replication slave role for the given database.-
Methods inherited from interface org.apache.derby.database.Database
backup, backupAndEnableLogArchiveMode, checkpoint, disableLogArchiveMode, freeze, getId, getLocale, isReadOnly, unfreeze
-
Methods inherited from interface org.apache.derby.iapi.services.i18n.LocaleFinder
getCurrentLocale, getDateFormat, getTimeFormat, getTimestampFormat
-
-
-
-
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 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
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 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:
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
-
-