|
1.51.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--interbase.interclient.ServerManager
Provides a session for servicing an InterBase server.
A server manager object is obtained thru a DataSource
using
DataSource.getServerManager().
The DataSource property named serverManagerHost
must be
set using
DataSource.setServerManagerHost(hostName).
See DataSource Properties
for a list of other DataSource and Connection properties.
The ServerManager may be used for setting persistent database properties, and for making service requests on databases and the server as a whole. Use connection properties for configuring transient properties of a connection. Use the DatabaseMetaData class for querying persistent database properties in general.
See the InterClient Extension API for a complete list of available InterBase extensions to JDBC.
Method Summary | |
void |
activateShadow(String shadow)
Activate a database shadow file. |
void |
addInterBaseLicense(String licenseKey,
String licenseId)
Converts the license id and key to a valid license and adds it to the server's license file. |
void |
addUser(String user,
String password,
Map userInformation)
Registers a user with the InterBase server. |
String |
backup(String database,
String[] backupFiles,
int[] backupFileLengths,
Map backupOptions)
Backs up a database to multiple backup files. |
String |
backup(String database,
String backupFile,
Map backupOptions)
Backs up a database to a single backup file. |
void |
bringOnline(String database)
Brings an offline database back online. |
void |
clearWarnings()
After this call, getWarnings returns null until a new warning is reported for this ServerManager. |
void |
close()
Close the server manager connection and release server manager resources. |
void |
commitTransactions(String database,
int[] transactionIds)
Attempt to commit limbo transactions. |
void |
createDatabase(String database,
Map databaseProperties)
Creates a single file database using the specified persistent database properties. |
void |
createShadow(String database,
String[] shadowFiles,
int[] shadowFileLengths,
Map shadowProperties)
Creates a multi-file shadow for a database. |
void |
createShadow(String database,
String shadow,
Map shadowProperties)
Creates a single shadow file for a database. |
void |
deleteDatabase(String database)
Remove the database file. |
void |
deleteInterBaseLicense(String licenseKey)
Removes the license specified by the licenseKey . |
void |
deleteShadow(String database)
Deletes the shadow file for a database. |
void |
deleteUser(String user)
Removes a registered user. |
protected void |
finalize()
A server manager connection will be closed when its finalizer is called by the garbage collector. |
String[] |
getDatabasesInUse()
Gets the names of databases with current connections. |
String[][] |
getInterBaseLicenses()
Gets all the InterBase license keys and IDs from the InterBase license file. |
String |
getInterBaseVersion()
What's the version string for the InterBase server. |
int |
getInterServerBuildCertificationLevel()
Gets the build certification level for this version of InterServer. |
int |
getInterServerBuildNumber()
What's the build number for InterServer. |
Date |
getInterServerExpirationDate()
Get the expiration date for the server side JDBC middleware server (InterServer). |
int |
getInterServerJDBCNetProtocolVersion()
Get the JDBC/Net protocol used by InterServer. |
int |
getInterServerMajorVersion()
What's the major version number for InterServer. |
int |
getInterServerMinorVersion()
What's the minor version number for InterServer. |
int |
getInterServerPort()
Get the JDBC/Net middleware server (InterServer) port. |
Object[] |
getLimboTransactions(String database)
Gets limbo transaction information for the database. |
InputStream |
getLockActivityStream(Map options)
Gets a continuous stream of InterBase lock activity from the server. |
int |
getNumberOfInterBaseConnectionsInUse()
Returns the total number of database connections to the InterBase server. |
Map |
getRegisteredUsers()
Returns registered user information as a map from username to a userInformation array object. |
String |
getStatisticsText(String database,
Map options)
Gets database statistics as a text string. |
SQLWarning |
getWarnings()
The first warning reported by calls on this ServerManager is returned. |
void |
modifyUser(String user,
Map newUserInformation)
Change the user information for a registered user. |
void |
modifyUser(String user,
String newPassword)
Change the password for a registered user. |
String |
repair(String database,
Map repairOptions)
Validate and mend the database where possible. |
void |
reserveSpaceForVersioning(String database,
boolean reserveSpace)
Specify whether or not space is reserved on each newly created database page for anticipated record versions. |
String |
restore(String backupFile,
String[] databaseFiles,
int[] databaseFileLengths,
Map restoreOptions)
Restores a backup to multiple database files. |
String |
restore(String backupFile,
String database,
Map restoreOptions)
Restores a backup to a single working database file. |
void |
rollbackTransactions(String database,
int[] transactionIds)
Rollback limbo transactions. |
void |
setDatabaseCachePages(String database,
int numCachePages)
Sets the number of cache page buffers to use for all connections to the specified database . |
void |
setDatabaseReadWrite(String database,
boolean readWrite)
Configure the database as read/write or read-only. |
void |
setSweepInterval(String database,
int interval)
Sets the periodicity of automatic garbage collection for the database. |
void |
startInterBase(int defaultCachedPages,
int defaultPageSize)
Start the InterBase service to allow for database connections. |
void |
stopInterBase()
Stop the InterBase service. |
String |
sweep(String database)
Manually sweep the database of old record versions. |
void |
takeOffline(String database,
boolean forceOffline,
boolean blockNewConnections,
boolean blockNewTransactions,
int timeout)
Prevent further database connections or transactions, or force the shutdown of existing ones. |
void |
twoPhaseCommitTransactions(String database,
int[] transactionIds)
Attempt to resolve limbo transactions using the two-phase commit protocol. |
void |
useSynchronousWrites(String database,
boolean synchronous)
Enable or disable synchronous writes to disk on commit. |
String |
verify(String database,
Map verifyOptions)
Verifies the database's internal page structures. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public int getInterServerMajorVersion()
DatabaseMetaData.getInterServerMajorVersion()
,
Driver.getMajorVersion()
public int getInterServerMinorVersion()
DatabaseMetaData.getInterServerMinorVersion()
,
Driver.getMinorVersion()
public int getInterServerBuildNumber()
Driver.getBuildNumber()
public int getInterServerBuildCertificationLevel()
The progression from test, beta, to final build is not static functionally. That is, new functionality may be added to a beta build that does not exist in a test build, and likewise, there may be new functionality in a final build which does not exist in a beta build of the same version.
Driver.getBuildCertificationLevel()
public int getInterServerJDBCNetProtocolVersion()
DatabaseMetaData.getInterServerJDBCNetProtocolVersion()
,
Driver.getJDBCNetProtocolVersion()
public Date getInterServerExpirationDate()
DatabaseMetaData.getInterServerExpirationDate()
,
Driver.getExpirationDate()
public int getInterServerPort()
DatabaseMetaData.getInterServerPort()
public String getInterBaseVersion() throws SQLException
DatabaseMetaData.getDatabaseProductVersion()
public String[] getDatabasesInUse() throws SQLException
public int getNumberOfInterBaseConnectionsInUse() throws SQLException
public String[][] getInterBaseLicenses() throws SQLException
isc_license.dat
.
This represents iblicense -display
functionality.
See the InterBase Operations Guide for details.public Map getRegisteredUsers() throws SQLException
isc4.gdb
.
This represents gsec display
functionality.
See the InterBase Operations Guide for details.
The user information array object for each user in the map is a 5-tuple containing
public InputStream getLockActivityStream(Map options) throws SQLException
iblockpr
functionality.
See the InterBase Operations Guide for details.
Parameter options
maps the following string-based keys:
TBD.
This method is a placeholder for possible future functionality.
public void startInterBase(int defaultCachedPages, int defaultPageSize) throws SQLException
ibmgr -start
functionality.
See the InterBase Operations Guide for details.
defaultPageSize
is the page size that will be used
by the InterBase server when a new database is created.
This affects the page size of a database created with the
createDatabase method.
defaultCachedPages
suggests the number of cached pages the InterBase server will use for
database attachments.
Database cache is the number of memory pages reserved for each attached database. If the figure is set high enough to accommodate the page requirements for all attached databases, overall performance is maximized because all database activity can be handled in physical RAM rather than having it swapped to disk. If too many pages are reserved, however, and you have many databases running simultaneously, your request may exceed the amount of physical RAM available to the system. If that happens, some of your operations would be swapped to disk as the operating system tries to manage the excessive demands of your databases and the needs of other running applications.
On Classic, the default number of pages cached is 75 for each connection. The minimum is 50 pages.
On SuperServer, a single page buffer cache is allocated per database, and shared between connections. The default allocation is 256 cached pages.
There are 3 ways to programmatically specify the number of cache pages:
suggestedCachePages
connection property, or
DataSource.setSuggestedCachePages,
but this value is transient and not stamped onto the database header page.
This transient setting takes precedence over the server-wide default,
but not any database-wide setting.
The number of cached database pages may also be set manually in the
server's ibconfig
file by
assigning the configuration parameter DATABASE_CACHE_PAGES
.
This manual server-wide setting takes precedence over any programmatic server-wide
setting, but is overriden by the database-wide and connection-wide programmatic
settings.
This method is a placeholder for possible future functionality.
DatabaseMetaData.getActualCachePagesInUse()
,
DatabaseMetaData.getPersistentDatabaseCachePages()
,
stopInterBase()
public void stopInterBase() throws SQLException
ibmgr -shut
functionality.
See the InterBase Operations Guide for details.
This command rolls back all active transactions and forces immediate shutdown of the server. Use with caution.
This method is a placeholder for possible future functionality.
startInterBase(int, int)
public void addInterBaseLicense(String licenseKey, String licenseId) throws SQLException
isc_license.dat
.
This represents iblicense -add
functionality.
See the InterBase Operations Guide for details.
The server will need to be restarted if the license being added changes the server from a local server to a remote server. This is necessary because the listener threads are started and allocated once the server starts up. If the license id and key being added simply adds user licenses to the server, no server restart is needed.
This service can also be used to add evaluation licenses. Evaluation licenses, however, can not be removed using the ServerManager or any other means.
public void deleteInterBaseLicense(String licenseKey) throws SQLException
licenseKey
.
The InterBase server maintains a license file named isc_license.dat
.
This represents iblicense -remove -key
functionality.
See the InterBase Operations Guide for details.
The server will need to be restarted if the license being removed changes server's state from a remote server to a local server. This is necessary because the listener threads will need to be shut down to complete the operation and cannot be shutdown while the server is in use. If the license id and key being removed simply removes user licenses to the server, no server restart is needed.
public void addUser(String user, String password, Map userInformation) throws SQLException
isc4.gdb
.
This represents gsec add
functionality.
See the InterBase Operations Guide for details.
userInformation
maps any of the following keys
to String or Integer objects:
firstName
gsec add -fname
functionality.
The first name of the user being added.
middleName
gsec add -mname
functionality.
The middle name of the user being added.
lastName
gsec add -lname
functionality.
The last name of the user being added.
unixUserId
gsec add -uid
functionality.
unixGroupId
gsec add -gid
functionality.
All such properties are optional.
Furthermore, the userInformation
map itself may be null.
When adding users to the security database, the only information required is the username and password and are restricted to ASCII characters. The information for first, middle, and last names are stored in Unicode.
By default, only SYSDBA is allowed to add user information in the security database, however, no checks are made by this API to enforce this. Since this is strictly enforced at the database level, it is possible for SYSDBA to grant update priviledges to those fields that can be updatable by end users.
The SQL role name used for this operation is the roleName
property
inherited from the DataSource
that produced this ServerManager.
public void deleteUser(String user) throws SQLException
isc4.gdb
.
This represents gsec delete
functionality.
See the InterBase Operations Guide for details.
Once a user has been removed from the security database, you will need to create a new user record using addUser before that user can connect to the server.
By default, only SYSDBA is allowed to remove user information in the security database, however, no checks are made by this API to enforce this. This is strictly enforced at the database level. This would allow the SYSDBA to grant update priviledges to those fields that can be updatable by end-users.
The SQL role name used for this operation is the roleName
property
inherited from the DataSource
that produced this ServerManager.
public void modifyUser(String user, Map newUserInformation) throws SQLException
isc4.gdb
.
This represents gsec modify
functionality.
See the InterBase Operations Guide for details.
newUserInformation
maps any of the following keys
to String or Integer objects:
password
gsec modify -pw
functionality.
The new password of the user being modified.
firstName
gsec modify -fname
functionality.
The new first name of the user being modified.
middleName
gsec modify -mname
functionality.
The new middle name of the user being modified.
lastName
gsec modify -lname
functionality.
The new last name of the user being modified.
unixUserId
gsec modify -uid
functionality.
unixGroupId
gsec modify -gid
functionality.
Only information that has a corresponding parameter will be modified. To change the user name, that user must be removed from the security database and then re-added.
By default only SYSDBA is allowed to modify user information in the security database. However, no checks are made by this API to enforce this. This is strictly enforced at the database level. This would allow SYSDBA to grant update priviledges to those fields that can be updatable by end-users.
The SQL role name used for this operation is the roleName
property
inherited from the DataSource
that produced this ServerManager.
public void modifyUser(String user, String newPassword) throws SQLException
This method is less general than modifyUser(user, newUserInformation), but is convenient for the common task of changing a user's password.
public void reserveSpaceForVersioning(String database, boolean reserveSpace) throws SQLException
This represents gfix -use full
, and
gfix -use reserve
functionality.
By default, an 80% fill ratio is used for newly created pages. If space reservation is disabled, then a 100% fill ratio is used.
The default is to reserve space for back versions in a database. It's only if the database is mostly archival (read only loosely-speaking) that no reserve space is recommended.
DatabaseMetaData.reservingSpaceForVersioning()
public void setDatabaseCachePages(String database, int numCachePages) throws SQLException
database
.
This is a persistent property of the database and is stamped
onto the database header page.
This represents gfix -buffers
functionality.
See the InterBase Operations Guide for details.
This persistent property of the database overrides
the suggestedCachePages
connection property (see
Connection Properties),
and also overrides the server-wide default set by
DATABASE_CACHE_PAGES
in the InterBase
ibconfig
startup file or by
startInterBase(defaultCachePages, defaultPageSize).
Upon connection, if a persistent database-wide cache pages property is not set, then the connection-wide setting is used if specified on connect, otherwise the server-wide default is used.
By default,
createDatabase
stamps a zero onto the database header page.
If this value is non-zero, it takes precedence over both the server-wide and
connection-wide settings. A connection-wide setting may be established using
the suggestedCachePages
connection property, see
Connection Properties,
or by DataSource.setSuggestedCachePages.
A server-wide setting may be established using
DATABASE_CACHE_PAGES
in the InterBase
ibconfig
startup file or by
startInterBase(defaultCachedPages, defaultPageSize).
The SuperServer architecture allocates a separate page buffer cache per database.
There is an absolute limitation of MAX_PAGE_BUFFERS (65535) pages imposed by InterBase code. So the cache memory size for a database cannot go beyond a maximum of MAX_PAGE_BUFFERS*PageSize bytes which amounts to 512MB for an 8K page size. 8K here is the maxiumum database page size currently allowed. If this property is 0 or unspecified, and there is no server-wide or database-wide default set, the default pages used is 256 cache pages.
DatabaseMetaData.getActualCachePagesInUse()
,
DatabaseMetaData.getPersistentDatabaseCachePages()
public void setDatabaseReadWrite(String database, boolean readWrite) throws SQLException
gfix
flag for this functionality to be determined.
See the InterBase Operations Guide for details.
By default, a database is read/write.
DatabaseMetaData.isDatabaseReadWrite()
public void setSweepInterval(String database, int interval) throws SQLException
gfix -housekeeping interval
functionality.
See the InterBase Operations Guide for more details.
The default sweep interval is 20,000.
To turn off automatic sweeping altogether, set the sweep interval to 0.
DatabaseMetaData.getSweepInterval()
public void useSynchronousWrites(String database, boolean synchronous) throws SQLException
gfix -write {sync | async}
functionality.
See the InterBase Operations Guide for more details.
If writes are asynchronous then data may not be physically written to disk on a database write, since operating systems buffer disk writes. If there is a system failure before the data is written to disk, then information can be lost.
Performing synchronous writes ensures data integrity and safety, but slower performance. In particular, operations which involve data modification are slower.
There are two significant shortcomings of using asynchronous writes:
So there are risks for database corruption if async writes are being used. The window of risk is the amount of time it takes your OS to write pages to disk once we have written them out to the OS cache. While this may seem like a small window, imagine a system under full load, pages being constantly updated. At any given time you may lose power, and certain pages will not be written out, or even worse pages may be written which expect the presence of other pages.
Sometimes the loss of a page is easily recoverable, such as when a new record is added to a data page. You will merely lose that new record. Other times the damage could be more severe. Some things can be fixed by gfix -mend. If that doesn't work, sometimes data can be recovered from a damaged database by copying it to another database one table at a time. But you do have to face the possibility of complete non-recovery of the database, though this is relatively rare.
So to be safe, those using asynchronous write should use a UPS, or at the very least take a backup once a day and be prepared, in the worst case, to lose that day's changes.
DatabaseMetaData.usingSynchronousWrites()
public void takeOffline(String database, boolean forceOffline, boolean blockNewConnections, boolean blockNewTransactions, int timeout) throws SQLException
gfix -shut -force timeout
,
gfix -shut -attach timeout
,
and
gfix -shut -tran timeout
functionality.
See the InterBase Operations Guide for details.
During the timeout period, new connections and/or transactions may
be prevented from starting.
If the forceOffline
option is disabled,
then at the end of the specified timeout
period,
if there are still open connections, this method is aborted and the
database is not taken offline.
If the forceOffline
option is enabled,
then at the end of the timeout period any open transactions
are rolled back, connections are disconnected, and the
database is taken offline.
This option should only be used as a last resort.
To force an immediate database shutdown,
specify forceOffline
with a timeout
period of 0.
Only the SYSDBA user or the database owner may invoke this method. Once a database is offline, sysdba or the database owner may connect to the offline database and operate on it in the normal fashion. Other users will be denied access.
Periodically you will want to shut down a database for backups and restores. Backup saves only the current committed version of each record while also putting all the data for each relation on contiguous pages in the database. Restore will rebuild all the indices and reset the statistics for each. This usually will increase performance significantly.
public void bringOnline(String database) throws SQLException
gfix -online
functionality.
See the InterBase Operations Guide for more details.public String backup(String database, String[] backupFiles, int[] backupFileLengths, Map backupOptions) throws SQLException
gbak -backup_database
functionality.
See the InterBase Operations Guide for details.
Parameter backupOptions
maps any of the following String-based keys
to String, Boolean, or Integer objects:
tapeDeviceBlockingFactor
gbak -backup_database -factor n
.
Use blocking factor n for a tape device.
nonTransportable
gbak -backup_database -nt
.
Create a non-transportable backup which may not be restored on another
machine architecture.
By default, gbak -backup_database -transportable
is used to produce
an architecture independent backup file in XDR format.
ignoreLimboTransactions
gbak -backup_database -limbo
.
Ignore limbo transactions during backup.
ignoreChecksums
gbak -backup_database -ignore
.
Ignore checksums during backup.
metaDataOnly
gbak -backup_database -metadata
.
Backup metadata only, no data.
inhibitGarbageCollection
gbak -backup_database -garbage_collect
.
Do not garbage collect during backup.
convertExternalFilesToInternalTables
gbak -backup_database -convert
.
Convert external files as internal tables.
verbose
gbak -backup_database -verify
.
Report details of the backup process.
This is the return value of the backup method.
oldDescriptions
gbak -backup_database -old_descriptions
.
Backup metadata in old-style format.
All such configuration information is optional.
Furthermore, the backupOptions
map itself may be null.
All boolean options are false
by default.
The user name and password used to obtain the ServerManager will be used to connect to the database for backup. This helps add some degree of security for this operation. Only SYSDBA or the database owner will be able to backup a database.
The SQL role name used for this operation is the roleName
property
inherited from the DataSource
that produced this ServerManager.
Under normal circumstances, when backing up a database, the backup file will always be located on the InterBase server machine since the backup service cannot open a file over a network connection. The backup service can create a remote file if the following conditions are true:
backup(String,String,java.util.Map)
public String backup(String database, String backupFile, Map backupOptions) throws SQLException
See the more general backup(database, backupFiles[], fileLengths[], infoMap) for details.
public String restore(String backupFile, String[] databaseFiles, int[] databaseFileLengths, Map restoreOptions) throws SQLException
gbak -c[reate_database]
or
gbak -r[eplace_database]
functionality.
See the InterBase Operations Guide for details.
Parameter restoreOptions
maps any of the following String-based keys
to String, Boolean, or Integer objects:
replaceDatabase
gbak -r[eplace_database]
.
Restore database to new file or replace existing file.
By default gbak -c[reate_database]
functionality is used
so that you can restore to a new file only;
an existing database file is not replaced.
pageSize
gbak {-r|-c} -page_size
.
The default is 1024 (1K).
cachePages
gbak {-r|-c} -buffers
.
See setDatabaseCachePages().
deactivateIndices
gbak {-r|-c} -inactive
.
dropValidityConstraints
gbak {-r|-c} -novalidity
.
Do not restore validity constraints when restoring metadata;
allows restoration of data that would otherwise not meet
validity constraints.
noShadow
gbak {-r|-c} -kill
.
Do not restore metadata references to shadows that were previously defined.
Subsequent database operations will not be shadowed.
oneTableAtATime
gbak {-r|-c} -one_at_a_time
.
Restore one table at a time.
This is useful for partial recovery of a database that contains corrupt data.
verbose
gbak {-r|-c} -verify
.
Report details of the restore.
This is the return value of the restore method.
reserveNoSpaceForVersioning
gbak {-r|-c} -use_all_space
.
See reserveSpaceForVersioning().
All such configuration information is optional.
Furthermore, the restoreOptions
map itself may be null.
All boolean options are false
by default.
The user name and password inherited from the DataSource
used to obtain this ServerManager is used to connect to the database
for restore. This adds some degree of security for this operation.
The SQL role name used for this operation is the roleName
property
inherited from the DataSource
that produced this ServerManager.
public String restore(String backupFile, String database, Map restoreOptions) throws SQLException
See the more general restore(backupFile, databaseFiles[], fileLengths[], infoMap) for details.
public String sweep(String database) throws SQLException
gfix -sweep
functionality.
See the InterBase Operations Guide for details.
Sweep does not require exclusive access, but if there are no active transactions on the database, then sweep can update certain data and transaction state information.
setSweepInterval(java.lang.String, int)
public String verify(String database, Map verifyOptions) throws SQLException
gfix -validate -no_update
functionality,
with other switches specified in the verifyOptions
map.
No database structures are updated.
See the InterBase Operations Guide for details.
Parameter verifyOptions
maps any of the following String-based keys
to Boolean objects:
full
gfix -validate -noupdate -full
.
This validate all records.
Without full validation, only page structures will be validated, which does
involve some limited checking of records.
ignoreChecksums
gfix -validate -noupdate -ignore
All such configuration information is optional.
Furthermore, the verifyOptions
map itself may be null.
This method will attempt to obtain exclusive access to the database. Verification requires exclusive access to ensure that database structures are not modified during validation. If there are other connections to the database, a SQLException will be thrown and the connection refused.
public String repair(String database, Map repairOptions) throws SQLException
gfix -validate -mend
functionality.
See the InterBase Operations Guide for details.
Note: Clearly this cannot repair all corrupt databases in general.
Parameter repairOptions
maps any of the following String-based keys
to Boolean objects:
full
gfix -validate -mend -full
.
Validate and mend record fragments.
Without full validation, only page structures will be validated,
which does involve some limited checking of records.
ignoreChecksums
gfix -validate -mend -ignore
.
killShadows
gfix -validate -mend -kill
..
Drops any shadow files associated with the database.
sweep
gfix -validate -mend -sweep
.
Sweeps the database.
All such configuration information is optional.
Furthermore, the repairOptions
map itself may be null.
This method will attempt to obtain exclusive access to the database. Verification and repair requires exclusive access to ensure that database structures are not modified during validation. If there are other connections to the database, a SQLException will be thrown and the connection refused.
public void createShadow(String database, String[] shadowFiles, int[] shadowFileLengths, Map shadowProperties) throws SQLException
Shadows are carbon copies of the database, and may be used as a protection against hardware failures by setting up a shadow file on a separate disk partition or even a separate machine from the database file. If your primary disk or server fails, the shadow file may be activated for use as a regular database file by using activateShadow(shadowFile). On activation, the shadow is no longer a shadow but becomes a regular database file. Users may then reconnect to the activated shadow file as a regular database file. Recovering in this way from a shadow file is quicker than restoring from a backup.
Shadows can be composed of multiple files just like normal databases.
A drawback to using shadows is that it doubles the number of writes the database server must perform.
Parameter shadowProperties
maps any of the following String-based keys
to Integer objects:
pageSize
All such properties are optional.
Furthermore, the shadowProperties
map itself may be null.
See the InterBase Operations Guide for further details on shadows.
This method is a placeholder for possible future API functionality.
Currently a shadow file may only be created by executing the SQL command
CREATE SHADOW
on a connection to the database.
Reviewers Note: Are there other shadow properties that should be specified?
public void createShadow(String database, String shadow, Map shadowProperties) throws SQLException
See the more general createShadow(database, shadowFiles[], lengths[], shadowProperties) for details.
public void activateShadow(String shadow) throws SQLException
gfix -activate
functionality.
See the InterBase Operations Guide for details.
Warning: Be sure the main database is offline with no attachments before activating its shadow. If a shadow is activated while the main database is online the shadow can be corrupted by existing attachments to the main database.
See the InterBase Operations Guide for further details on shadows.
public void deleteShadow(String database) throws SQLException
gfix -kill
functionality.
See the InterBase Operations Guide for details.
A shadow file may also be deleted by executing the SQL command
DROP SHADOW
on a connection to the database.
public void createDatabase(String database, Map databaseProperties) throws SQLException
Parameter databaseProperties
maps any of the following String-based keys
to Boolean or Integer objects:
pageSize
reserveSpaceForVersioning
useSynchronousWrites
cachePages
sweepInterval
All such properties are optional.
Furthermore, the databaseProperties
map itself may be null.
All boolean configurables default to true
,
the page size defaults to 1024 (1K), the sweep interval defaults
to 20,000, and the cachePages
default stamped onto the database header page is 0.
The server-wide defaults for page size and cache pages can be configured using
DATABASE_CACHE_PAGES
in the InterBase ibconfig
startup file or
when starting the server dynamically with
ServerManager.startInterBase(defaultCachePages, defaultPageSize).
Note:
The SQL string CREATE DATABASE ...
cannot be executed with InterClient
because SQL is executed within the context of a Connection in JDBC.
Connectionless SQL is not allowed.
Reviewers Note: Do we need sqlDialect as an option as well?
public void deleteDatabase(String database) throws SQLException
public Object[] getLimboTransactions(String database) throws SQLException
gfix -list
functionality.
See the InterBase Operations Guide for more details.
The object[]
array returned contains the following information:
TBD.
public void rollbackTransactions(String database, int[] transactionIds) throws SQLException
gfix -rollback
functionality.
See the InterBase Operations Guide for more details.public void commitTransactions(String database, int[] transactionIds) throws SQLException
gfix -commit
functionality.
See the InterBase Operations Guide for more details.public void twoPhaseCommitTransactions(String database, int[] transactionIds) throws SQLException
gfix -two_phase
functionality.
See the InterBase Operations Guide for more details.public String getStatisticsText(String database, Map options) throws SQLException
gstat
functionality.
See the InterBase Operations Guide for details.
Parameter options
maps the following string-based keys to Boolean objects:
header
gstat -header
functionality.
Stop reporting statistics after reporting the information on the header page.
False by default.
log
gstat -log
functionality.
Stop reporting statistics after reporting the information on the log pages.
False by default.
index
gstat -index
functionality.
Retrieve and display statistics on indexes in the database.
True by default.
data
gstat -data
functionality.
Retrieve and display statistics on data tables in the database.
True by default.
system
gstat -system
functionality.
Retrieve statistics on system tables and indexes in addition to user tables
and indices.
False by default.
Reading header information would normally not require that the server be running. However, in order to read the header information using this API, the server must be running as the logic for doing this is not in the client.
Only the SYSDBA user or the database owner may run this service.
This method is a placeholder for possible future functionality.
public SQLWarning getWarnings() throws SQLException
public void clearWarnings() throws SQLException
protected void finalize() throws Throwable
Therefore, it is recommended that server manager connections be explicitly closed even if your application throws an exception. This can be achieved by placing a call to close() in a finally clause of your application as follows
try { ... } finally { if (serverManager != null) try { serverManager.close (); } catch (SQLException e) {} }
Or alternatively, use the System.runFinalizersOnExit(boolean) method.
public void close() throws SQLException
In most cases, it is desirable to immediately release a
ServerManager connection instead of waiting for
it to be automatically released; the close
method provides this
immediate release.
Note: A ServerManager connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed ServerManager.
|
1.51.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |