|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A connection (session) with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.
A Connection's database is able to provide information
describing its tables, supported SQL grammar, its stored
procedures, the capabilities of this connection and so on. This
information is obtained with the getMetaData
method.
Note: By default the Connection automatically commits changes after executing each statement. If auto commit has been disabled, an explicit commit must be done or the database changes will not be saved.
Statement
,
ResultSet
,
DatabaseMetaData
Field Summary |
---|
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Method Summary | |
---|---|
void |
backup(java.io.OutputStream stream)
Online backup of the database. |
void |
checkInTable(java.lang.String tableName,
java.sql.Connection conxn)
Synchronize the replica and master table. |
void |
checkOutTable(java.lang.String tableName,
java.sql.Connection conxn)
Update replica table by transfering all changes from the master table. |
void |
commitSubtransaction()
Commit nested subtransaction. |
java.sql.Blob |
createBlob(long length,
java.io.InputStream in)
Create BLOB |
java.sql.Clob |
createClob(long length,
java.io.Reader in)
Create CLOB |
java.sql.Clob |
createClob(java.lang.String str)
Create CLOB |
void |
createObjectCache()
Allocate object cache (instance manager) if not yet allocated. |
StringIndex |
createStringIndex()
Create a new String index in the database. |
void |
doGarbageCollection()
Explicitly initiate new garbage collection (if not yet started) |
void |
enableTracing(boolean enabled)
Switch tracing on/off. |
java.lang.Object |
get(java.sql.Ref ref)
Get object by it's OID |
java.lang.String |
getMasterFieldName()
Get the name of the field containing the referenence to the master object instance on the server (used for table replication) if null then an existing primary key will be used instead. |
boolean |
getThreadAutoCommit()
Gets the current auto-commit state. |
java.lang.String |
getTimestampFieldName()
Get the name of the timestamp field used for data replication. |
long |
getUsedSize()
Get the size used by objects in the database |
java.sql.Ref |
insert(java.lang.Object obj)
Insert the specified object into the database. |
void |
lock()
Lock the database in exclusive mode. |
void |
remove(java.sql.Ref ref)
Remove object with specifed OID |
void |
setGCRoots(java.lang.String[] tableNames)
Specify root tables for garbage collection. |
void |
setGCThreshold(long threshold)
Specify the size of allocated objects after which GC should be initiated. |
void |
setMasterFieldName(java.lang.String name)
Set the name of the field containing the refenence to the master object instance on the server (used for table replication). |
void |
setThreadAutoCommit(boolean autoCommit)
Set autocommit mode only for the current thread. |
void |
setTimestampFieldName(java.lang.String name)
Set the name of the timestamp field used for data replication. |
void |
update(java.sql.Ref ref,
java.lang.Object obj)
Update the object in the table. |
Methods inherited from interface java.sql.Connection |
---|
clearWarnings, close, commit, createStatement, createStatement, createStatement, getAutoCommit, getCatalog, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
Methods inherited from interface org.garret.consus.PersistentObjectStorage |
---|
becomeObject, clearComponents, clearObjectCache, deleteObject, fetchObject, getObjectByOid, getObjectCacheSize, getTableIterator, isInitialized, loadComponents, loadObject, open, storeObject, updateObject |
Method Detail |
---|
void backup(java.io.OutputStream stream) throws java.sql.SQLException, java.io.IOException
stream
- to were backup is performed
java.sql.SQLException
java.io.IOException
void checkInTable(java.lang.String tableName, java.sql.Connection conxn) throws java.sql.SQLException
MergeConflictException
is thrown.
The exception object is given the value of the key of the record that caused the conflict.
Then Consus will transfer all the records which were changed by the client to the master
table, assigning them the value of timestamp greater than of any other record in the
master table. It is possible to perform check-ins several times, synchronizing content
of the master and replica tables.
tableName
- name of the table to check-inconxn
- database connection
MergeConflictException
java.sql.SQLException
void checkOutTable(java.lang.String tableName, java.sql.Connection conxn) throws java.sql.SQLException
recordTimestamp
and optionally masterOID
fields.
Then the application can close connection with the server and work normally with
replica table, autonomously.
tableName
- name of the table to check-outconxn
- database connection
java.sql.SQLException
void commitSubtransaction() throws java.sql.SQLException
java.sql.SQLException
java.sql.Blob createBlob(long length, java.io.InputStream in)
length
- size of stored datain
- input stream to provide BLOB data
ConsusBlob
java.sql.Clob createClob(long length, java.io.Reader in)
length
- number of charactersin
- reader to provide CLOB data
ConsusClob
java.sql.Clob createClob(java.lang.String str)
str
- - string which will be stored as CLOB body
ConsusClob
void createObjectCache()
StringIndex createStringIndex() throws java.sql.SQLException
java.sql.SQLException
void doGarbageCollection() throws java.sql.SQLException
java.sql.SQLException
void enableTracing(boolean enabled)
enabled
- - switch on tracing when true
java.lang.Object get(java.sql.Ref ref) throws java.sql.SQLException
ref
- reference to the object
java.sql.SQLException
java.lang.String getMasterFieldName()
null
then an existing primary key will be used instead.
boolean getThreadAutoCommit() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occursConnection.setAutoCommit(boolean)
java.lang.String getTimestampFieldName()
long getUsedSize() throws java.sql.SQLException
java.sql.SQLException
java.sql.Ref insert(java.lang.Object obj) throws java.sql.SQLException
obj
- Java object to be inserted
java.sql.SQLException
void lock() throws java.lang.Exception
lock
in interface PersistentObjectStorage
java.lang.Exception
void remove(java.sql.Ref ref) throws java.sql.SQLException
ref
- reference to the removed object
java.sql.SQLException
void setGCRoots(java.lang.String[] tableNames) throws java.sql.SQLException
tableNames
- array with table names
java.sql.SQLException
void setGCThreshold(long threshold) throws java.sql.SQLException
threshold
- difference between allocated and deallocated object since last GC
after which a new GC is initiated. By default it is set to Long.MAX_VALUE
so GC is disabled.
java.sql.SQLException
void setMasterFieldName(java.lang.String name)
name
- name of the field, if null
then an existing primary key will be used insteadvoid setThreadAutoCommit(boolean autoCommit) throws java.sql.SQLException
java.sql.SQLException
void setTimestampFieldName(java.lang.String name)
name
- name of the timestamp fieldvoid update(java.sql.Ref ref, java.lang.Object obj) throws java.sql.SQLException
ref
- reference to the updated objectobj
- object with new values
java.sql.SQLException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |