|
1.50.39 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--interbase.interclient.ConnectionProperties
Properties used to tailor a connection.
This class is used to tailor connection properties before attaching to an InterBase database. Using this class is an alternative to configuring a java.util.Properties object directly. For example,
Properties.put ("charSet", "SJIS")is identical to
ConnectionProperties.setCharacterEncoding ("SJIS").
Driver.connect(java.lang.String,java.util.Properties)
, Serialized FormFields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
ConnectionProperties()
Construct a default InterBase connection properties object. |
Method Summary | |
void |
allowAsynchronousDiskWrites(boolean asynchronous)
Enable/disable synchronous writes to disk on commit. |
void |
disablePageStructureVerification()
Reset verification requests. |
void |
enableHouseKeeping(boolean enable)
Enable the server to perform periodic garbage collection automatically. |
void |
reserveNoSpaceForVersioning(boolean noreserve)
Specify whether or not space is reserved on each newly created database page for anticipated record versions. |
void |
setCacheBuffers(int num)
Set the suggested number of cache page buffers to use for this connection. |
void |
setCharacterEncoding(String encoding)
Specify the character encoding for the connection. |
void |
setExclusiveAccess(boolean exclusive)
Once a connection is established with this configuration, do not allow subsequent connections to the database. |
void |
setHouseKeepingSweepInterval(int interval)
Specify the periodicity of automatic garbage collection. |
void |
setUser(String user,
String password)
Set the user and password for the pending connection. |
void |
sweep(boolean forceSweep)
Force garbage collection of outdated records immediately upon connection. |
void |
verifyPageStructures(boolean checkAllRecords,
boolean mend,
boolean releaseFreePages)
On connection, verify the database's internal page structures. |
Methods inherited from class java.util.Properties |
getProperty,
getProperty,
list,
list,
load,
propertyNames,
save,
setProperty,
store |
Methods inherited from class java.util.Hashtable |
clear,
clone,
contains,
containsKey,
containsValue,
elements,
entrySet,
equals,
get,
hashCode,
isEmpty,
keys,
keySet,
put,
putAll,
rehash,
remove,
size,
toString,
values |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public ConnectionProperties()
Method Detail |
public void setUser(String user, String password)
The corresponding connection property keys are "user" and "password".
public void setCharacterEncoding(String encoding)
The connection property key is "charSet".
Property values must match one of the supported IANA character encoding names specified in the CharacterEncodings class.
public void setExclusiveAccess(boolean exclusive)
The connection property key is TBD
public void reserveNoSpaceForVersioning(boolean noreserve)
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.
The connection property key is TBD
DatabaseMetaData.isSpaceReservedForVersioning()
public void allowAsynchronousDiskWrites(boolean asynchronous)
If synchronous writes are not enabled, then even though InterBase performs a write, the data may not be physically written to disk, 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 slow performance. In particular, operations which involve data modification are slower.
The default for Unix is asynchronous and for NT it is synchronous. I think it's this way because it was thought people with PCs power off their machines whereas Unix users usually perform an orderly shutdown.
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.
The connection property key is TBD
DatabaseMetaData.isSynchronous()
public void verifyPageStructures(boolean checkAllRecords, boolean mend, boolean releaseFreePages)
If the database structures are not verifiable then a SQLException will be thrown when the connection is attempted.
With this verification enabled, a subsequent connection request 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.
Here's the meaning of the two verification options
The connection property key is TBD
public void disablePageStructureVerification()
The connection property key is TBD
public void setCacheBuffers(int num)
This is a transient property of the connection and is overridden by the database-wide default set by Server.setCacheBuffers(database), but takes precedence over the server-wide default set by ServerProperties.setDefaultCacheBuffers().
On SuperServer, if a database cache already exists due to another attachment to the database then the cache size may be increased but not decreased.
Note: This method may jeopardize the performance of the server because an arbitrary user can connect and reserve 200MB for foo.gdb while corporate.gdb is forced to accept less.
The connection property key is TBD
DatabaseMetaData.getCacheBuffers()
,
Server.setCacheBuffers(java.lang.String, int)
,
ServerProperties.setDefaultCacheBuffers(int)
public void sweep(boolean forceSweep)
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.
The connection property key is TBD
public void enableHouseKeeping(boolean enable)
The connection property key is TBD
public void setHouseKeepingSweepInterval(int interval)
The connection property key is TBD
|
1.50.39 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |