Top Description Fields Methods
org.apache.derby.iapi.db

public Interface Database

extends Database, LocaleFinder
Known Direct Implementers
org.apache.derby.impl.db.BasicDatabase
Imports
org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.ResultSet, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.sql.dictionary.DataDictionary, org.apache.derby.iapi.jdbc.AuthenticationService, org.apache.derby.shared.common.i18n.LocaleFinder, java.io.InputStream, .OutputStream, java.sql.Date, .SQLException, java.util.Hashtable, .Locale

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

Inherited from org.apache.derby.database.Database:
LUCENE_DIR

Method Summary

Modifier and TypeMethod and Description
public void
failover(String
the replication database that is being failed over.
dbname
)

Start failover for the given database.

public AuthenticationService

Returns:

The authentication service handle for the database
getAuthenticationService
()

This method returns the authentication service handle for the database.

public DataDictionary

Returns:

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

Return the DataDictionary for this database, set up at boot time.

public int

Returns:

the engine type
getEngineType
()

public Object

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.
getResourceAdapter
()

Get a Resource Adapter - only used by XA system.

public boolean

Returns:

true if the database is open
isActive
()

Is the database active (open).

public boolean

Returns:

true if this database is in replication slave mode, false otherwise.
isInSlaveMode
()

Used to indicated whether the database is in the replication slave mode.

public void
pushDbContext(ContextManager
The context manager
cm
)

Push a DbContext onto the provided context stack.

public void
setLocale(Locale
The locale to set
locale
)

Set the Locale that is returned by this LocaleFinder

public LanguageConnectionContext

Returns:

A new LanguageConnectionContext
setupConnection
(ContextManager
The context manager
cm
,
String
The UserID of the user getting the connection
user
,
String
The drda id of the connection (from network server)
drdaID
,
String
The database name
dbname
)

Sets up a connection to the Database, owned by the given user.

public void
startReplicationMaster(String
The master database that is being replicated.
dbmaster
,
String
The hostname for the slave
host
,
int
The port the slave is listening on
port
,
String
The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.
replicationMode
)

Start the replication master role for this database

public void
stopReplicationMaster()

Stop the replication master role for the given database.

public void
stopReplicationSlave()

Stop the replication slave role for the given database.

Inherited from org.apache.derby.database.Database:
backupbackupAndEnableLogArchiveModecheckpointdisableLogArchiveModefreezegetIdgetLocaleisReadOnlyunfreeze
Inherited from org.apache.derby.shared.common.i18n.LocaleFinder:
getCurrentLocalegetDateFormatgetTimeFormatgetTimestampFormat

Method Detail

failoverback to summary
public void failover(String dbname) throws StandardException

Start failover for the given database.

Parameters
dbname:String

the replication database that is being failed over.

Exceptions
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.
getAuthenticationServiceback to summary
public 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:AuthenticationService

The authentication service handle for the database

Exceptions
StandardException:
standard Derby exception policy
getDataDictionaryback to summary
public DataDictionary getDataDictionary()

Return the DataDictionary for this database, set up at boot time.

Returns:DataDictionary

the DataDictionary for this database, set up at boot time.

getEngineTypeback to summary
public int getEngineType()
Returns:int

the engine type

getResourceAdapterback to summary
public Object getResourceAdapter()

Get a Resource Adapter - only used by XA system. There is one and only one resource adapter per Derby database.

Returns:Object

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.

isActiveback to summary
public boolean isActive()

Is the database active (open).

Returns:boolean

true if the database is open

isInSlaveModeback to summary
public boolean isInSlaveMode()

Used to indicated whether the database is in the replication slave mode.

Returns:boolean

true if this database is in replication slave mode, false otherwise.

pushDbContextback to summary
public 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.

Parameters
cm:ContextManager

The context manager

setLocaleback to summary
public void setLocale(Locale locale)

Set the Locale that is returned by this LocaleFinder

Parameters
locale:Locale

The locale to set

setupConnectionback to summary
public 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
cm:ContextManager

The context manager

user:String

The UserID of the user getting the connection

drdaID:String

The drda id of the connection (from network server)

dbname:String

The database name

Returns:LanguageConnectionContext

A new LanguageConnectionContext

Exceptions
StandardException:
thrown if unable to create the connection.
startReplicationMasterback to summary
public void startReplicationMaster(String dbmaster, String host, int port, String replicationMode) throws SQLException

Start the replication master role for this database

Parameters
dbmaster:String

The master database that is being replicated.

host:String

The hostname for the slave

port:int

The port the slave is listening on

replicationMode:String

The type of replication contract. Currently only asynchronous replication is supported, but 1-safe/2-safe/very-safe modes may be added later.

Exceptions
SQLException:
Thrown on error
stopReplicationMasterback to summary
public void stopReplicationMaster() throws SQLException

Stop the replication master role for the given database.

Exceptions
SQLException:
Thrown on error
stopReplicationSlaveback to summary
public void stopReplicationSlave() throws SQLException

Stop the replication slave role for the given database.

Exceptions
SQLException:
Thrown on error