Package org.h2.engine
Class SessionRemote
java.lang.Object
org.h2.engine.Session
org.h2.engine.SessionRemote
- All Implemented Interfaces:
 AutoCloseable,CastDataProvider,org.h2.store.DataHandler
The client side part of a session when using the server mode. This object
 communicates with a Session on the server side.
- 
Nested Class Summary
Nested classes/interfaces inherited from class org.h2.engine.Session
Session.DynamicSettings, Session.StaticSettings - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionorg.h2.value.ValueLobaddTemporaryLob(org.h2.value.ValueLob v) Add a temporary LOB, which is closed when the session commits.voidCalls COMMIT if the session is in cluster mode.voidcancel()Cancel the current or next command (called when closing a connection).voidcancelStatement(int id) Cancel the statement with the given id.voidCheck if this session is closed and throws an exception if so.voidCheck if the simulated power failure occurred.voidCheck if writing is allowed.voidclose()Roll back pending transactions and close the session.connectEmbeddedOrServer(boolean openNew) Open a new (remote or embedded) session.org.h2.value.ValueTimestampTimeZoneReturns the current timestamp with maximum resolution.org.h2.util.TimeZoneProviderReturns the current time zone.voiddone(org.h2.value.Transfer transfer) Called to flush the output after data has been sent to the server and just before receiving data.booleanCheck if this session is in auto-commit mode.intReturns the TCP protocol version of remote connection.Get the list of the cluster servers for this session.org.h2.value.CompareModeReturn compare mode.intGet current schema.org.h2.jdbc.meta.DatabaseMetaReturns database meta information.Get the database path.org.h2.store.DataHandlerGet the data handler object.Returns dynamic settings.Returns the isolation level.Returns the custom Java object serializer, ornull.intGet the lob file list cache if it is used.org.h2.store.LobStorageFrontendGet the lob storage mechanism to use.Get the synchronization object for lob operations.intGet the maximum length of in-place large objectgetMode()Returns the database mode.intReturns static settings.org.h2.util.TempFileDeleterGet the temp file deleter mechanism.org.h2.message.TracegetTrace()Get the trace objectbooleanCheck whether this session has a pending transaction.booleanisClosed()Check if close was called.booleanReturns true if the connection was opened in cluster mode.booleanReturns whether INFORMATION_SCHEMA contains old-style tables.booleanisRemote()Check if this session is remote or embedded.org.h2.store.FileStoreOpen a file at the given location.org.h2.command.CommandInterfaceprepareCommand(String sql) Parse a command and prepare it for execution.static org.h2.message.DbExceptionreadException(org.h2.value.Transfer transfer) Reads an exception.intreadLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length) Read from a lob.voidRead the session state if necessary.static SQLExceptionreadSQLException(org.h2.value.Transfer transfer) Reads an exception as SQL exception.voidremoveServer(IOException e, int i, int count) Remove a server from the list of cluster nodes and disables the cluster mode.voidsetAutoCommit(boolean autoCommit) Set the auto-commit mode.voidsetAutoCommitFromServer(boolean autoCommit) voidsetCurrentSchemaName(String schema) Set current schema.voidsetIsolationLevel(IsolationLevel isolationLevel) Sets the isolation level.voidsetNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo) Sets the network connection information if possible.voidtraceOperation(String operation, int id) Write the operation to the trace system if debug trace is enabled.booleanReturns are ENUM values 0-based.Methods inherited from class org.h2.engine.Session
isLockedByCurrentThread, lock, resetThreadLocalSession, setThreadLocalSession, unlock 
- 
Field Details
- 
SESSION_PREPARE
public static final int SESSION_PREPARE- See Also:
 
 - 
SESSION_CLOSE
public static final int SESSION_CLOSE- See Also:
 
 - 
COMMAND_EXECUTE_QUERY
public static final int COMMAND_EXECUTE_QUERY- See Also:
 
 - 
COMMAND_EXECUTE_UPDATE
public static final int COMMAND_EXECUTE_UPDATE- See Also:
 
 - 
COMMAND_CLOSE
public static final int COMMAND_CLOSE- See Also:
 
 - 
RESULT_FETCH_ROWS
public static final int RESULT_FETCH_ROWS- See Also:
 
 - 
RESULT_RESET
public static final int RESULT_RESET- See Also:
 
 - 
RESULT_CLOSE
public static final int RESULT_CLOSE- See Also:
 
 - 
COMMAND_COMMIT
public static final int COMMAND_COMMIT- See Also:
 
 - 
CHANGE_ID
public static final int CHANGE_ID- See Also:
 
 - 
COMMAND_GET_META_DATA
public static final int COMMAND_GET_META_DATA- See Also:
 
 - 
SESSION_SET_ID
public static final int SESSION_SET_ID- See Also:
 
 - 
SESSION_CANCEL_STATEMENT
public static final int SESSION_CANCEL_STATEMENT- See Also:
 
 - 
SESSION_CHECK_KEY
public static final int SESSION_CHECK_KEY- See Also:
 
 - 
SESSION_SET_AUTOCOMMIT
public static final int SESSION_SET_AUTOCOMMIT- See Also:
 
 - 
SESSION_HAS_PENDING_TRANSACTION
public static final int SESSION_HAS_PENDING_TRANSACTION- See Also:
 
 - 
LOB_READ
public static final int LOB_READ- See Also:
 
 - 
SESSION_PREPARE_READ_PARAMS2
public static final int SESSION_PREPARE_READ_PARAMS2- See Also:
 
 - 
GET_JDBC_META
public static final int GET_JDBC_META- See Also:
 
 - 
COMMAND_EXECUTE_BATCH_UPDATE
public static final int COMMAND_EXECUTE_BATCH_UPDATE- See Also:
 
 - 
STATUS_ERROR
public static final int STATUS_ERROR- See Also:
 
 - 
STATUS_OK
public static final int STATUS_OK- See Also:
 
 - 
STATUS_CLOSED
public static final int STATUS_CLOSED- See Also:
 
 - 
STATUS_OK_STATE_CHANGED
public static final int STATUS_OK_STATE_CHANGED- See Also:
 
 
 - 
 - 
Constructor Details
- 
SessionRemote
 
 - 
 - 
Method Details
- 
getClusterServers
Description copied from class:SessionGet the list of the cluster servers for this session.- Specified by:
 getClusterServersin classSession- Returns:
 - A list of "ip:port" strings for the cluster servers in this session.
 
 - 
hasPendingTransaction
public boolean hasPendingTransaction()Description copied from class:SessionCheck whether this session has a pending transaction.- Specified by:
 hasPendingTransactionin classSession- Returns:
 - true if it has
 
 - 
cancel
public void cancel()Description copied from class:SessionCancel the current or next command (called when closing a connection). - 
cancelStatement
public void cancelStatement(int id) Cancel the statement with the given id.- Parameters:
 id- the statement id
 - 
getClientVersion
public int getClientVersion()Returns the TCP protocol version of remote connection.- Returns:
 - the TCP protocol version
 
 - 
getAutoCommit
public boolean getAutoCommit()Description copied from class:SessionCheck if this session is in auto-commit mode.- Specified by:
 getAutoCommitin classSession- Returns:
 - true if the session is in auto-commit mode
 
 - 
setAutoCommit
public void setAutoCommit(boolean autoCommit) Description copied from class:SessionSet the auto-commit mode. This call doesn't commit the current transaction.- Specified by:
 setAutoCommitin classSession- Parameters:
 autoCommit- the new value
 - 
setAutoCommitFromServer
public void setAutoCommitFromServer(boolean autoCommit)  - 
autoCommitIfCluster
public void autoCommitIfCluster()Calls COMMIT if the session is in cluster mode. - 
connectEmbeddedOrServer
Open a new (remote or embedded) session.- Parameters:
 openNew- whether to open a new session in any case- Returns:
 - the session
 
 - 
removeServer
Remove a server from the list of cluster nodes and disables the cluster mode.- Parameters:
 e- the exception (used for debugging)i- the index of the server to removecount- the retry count index
 - 
prepareCommand
Description copied from class:SessionParse a command and prepare it for execution.- Specified by:
 prepareCommandin classSession- Parameters:
 sql- the SQL statement- Returns:
 - the prepared command
 
 - 
checkClosed
public void checkClosed()Check if this session is closed and throws an exception if so.- Throws:
 org.h2.message.DbException- if the session is closed
 - 
close
public void close()Description copied from class:SessionRoll back pending transactions and close the session.- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein classSession
 - 
getTrace
public org.h2.message.Trace getTrace()Description copied from class:SessionGet the trace object - 
getNextId
public int getNextId() - 
getCurrentId
public int getCurrentId() - 
done
Called to flush the output after data has been sent to the server and just before receiving data. This method also reads the status code from the server and throws any exception the server sent.- Parameters:
 transfer- the transfer object- Throws:
 org.h2.message.DbException- if the server sent an exceptionIOException- if there is a communication problem between client and server
 - 
readException
public static org.h2.message.DbException readException(org.h2.value.Transfer transfer) throws IOException Reads an exception.- Parameters:
 transfer- the transfer object- Returns:
 - the exception
 - Throws:
 IOException- on I/O exception
 - 
readSQLException
Reads an exception as SQL exception.- Parameters:
 transfer- the transfer object- Returns:
 - the exception
 - Throws:
 IOException- on I/O exception
 - 
isClustered
public boolean isClustered()Returns true if the connection was opened in cluster mode.- Returns:
 - true if it is
 
 - 
isClosed
public boolean isClosed()Description copied from class:SessionCheck if close was called. - 
traceOperation
Write the operation to the trace system if debug trace is enabled.- Parameters:
 operation- the operation performedid- the id of the operation
 - 
checkPowerOff
public void checkPowerOff()Description copied from interface:org.h2.store.DataHandlerCheck if the simulated power failure occurred. This call will decrement the countdown.- Specified by:
 checkPowerOffin interfaceorg.h2.store.DataHandler
 - 
checkWritingAllowed
public void checkWritingAllowed()Description copied from interface:org.h2.store.DataHandlerCheck if writing is allowed.- Specified by:
 checkWritingAllowedin interfaceorg.h2.store.DataHandler
 - 
getDatabasePath
Description copied from interface:org.h2.store.DataHandlerGet the database path.- Specified by:
 getDatabasePathin interfaceorg.h2.store.DataHandler- Returns:
 - the database path
 
 - 
getMaxLengthInplaceLob
public int getMaxLengthInplaceLob()Description copied from interface:org.h2.store.DataHandlerGet the maximum length of in-place large object- Specified by:
 getMaxLengthInplaceLobin interfaceorg.h2.store.DataHandler- Returns:
 - the maximum size
 
 - 
openFile
Description copied from interface:org.h2.store.DataHandlerOpen a file at the given location.- Specified by:
 openFilein interfaceorg.h2.store.DataHandler- Parameters:
 name- the file namemode- the modemustExist- whether the file must already exist- Returns:
 - the file
 
 - 
getDataHandler
public org.h2.store.DataHandler getDataHandler()Description copied from class:SessionGet the data handler object.- Specified by:
 getDataHandlerin classSession- Returns:
 - the data handler
 
 - 
getLobSyncObject
Description copied from interface:org.h2.store.DataHandlerGet the synchronization object for lob operations.- Specified by:
 getLobSyncObjectin interfaceorg.h2.store.DataHandler- Returns:
 - the synchronization object
 
 - 
getLobFileListCache
Description copied from interface:org.h2.store.DataHandlerGet the lob file list cache if it is used.- Specified by:
 getLobFileListCachein interfaceorg.h2.store.DataHandler- Returns:
 - the cache or null
 
 - 
getLastReconnect
public int getLastReconnect() - 
getTempFileDeleter
public org.h2.util.TempFileDeleter getTempFileDeleter()Description copied from interface:org.h2.store.DataHandlerGet the temp file deleter mechanism.- Specified by:
 getTempFileDeleterin interfaceorg.h2.store.DataHandler- Returns:
 - the temp file deleter
 
 - 
getLobStorage
public org.h2.store.LobStorageFrontend getLobStorage()Description copied from interface:org.h2.store.DataHandlerGet the lob storage mechanism to use.- Specified by:
 getLobStoragein interfaceorg.h2.store.DataHandler- Returns:
 - the lob storage mechanism
 
 - 
readLob
public int readLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length) Description copied from interface:org.h2.store.DataHandlerRead from a lob.- Specified by:
 readLobin interfaceorg.h2.store.DataHandler- Parameters:
 lobId- the lob idhmac- the message authentication codeoffset- the offset within the lobbuff- the target bufferoff- the offset within the target bufferlength- the number of bytes to read- Returns:
 - the number of bytes read
 
 - 
getJavaObjectSerializer
Description copied from interface:CastDataProviderReturns the custom Java object serializer, ornull.- Specified by:
 getJavaObjectSerializerin interfaceCastDataProvider- Returns:
 - the custom Java object serializer, or 
null 
 - 
addTemporaryLob
public org.h2.value.ValueLob addTemporaryLob(org.h2.value.ValueLob v) Description copied from class:SessionAdd a temporary LOB, which is closed when the session commits.- Specified by:
 addTemporaryLobin classSession- Parameters:
 v- the value- Returns:
 - the specified value
 
 - 
getCompareMode
public org.h2.value.CompareMode getCompareMode()Description copied from interface:org.h2.store.DataHandlerReturn compare mode.- Specified by:
 getCompareModein interfaceorg.h2.store.DataHandler- Returns:
 - Compare mode.
 
 - 
isRemote
public boolean isRemote()Description copied from class:SessionCheck if this session is remote or embedded. - 
getCurrentSchemaName
Description copied from class:SessionGet current schema.- Specified by:
 getCurrentSchemaNamein classSession- Returns:
 - the current schema name
 
 - 
setCurrentSchemaName
Description copied from class:SessionSet current schema.- Specified by:
 setCurrentSchemaNamein classSession- Parameters:
 schema- the schema name
 - 
setNetworkConnectionInfo
public void setNetworkConnectionInfo(org.h2.util.NetworkConnectionInfo networkConnectionInfo) Description copied from class:SessionSets the network connection information if possible.- Specified by:
 setNetworkConnectionInfoin classSession- Parameters:
 networkConnectionInfo- the network connection information
 - 
getIsolationLevel
Description copied from class:SessionReturns the isolation level.- Specified by:
 getIsolationLevelin classSession- Returns:
 - the isolation level
 
 - 
setIsolationLevel
Description copied from class:SessionSets the isolation level.- Specified by:
 setIsolationLevelin classSession- Parameters:
 isolationLevel- the isolation level to set
 - 
getStaticSettings
Description copied from class:SessionReturns static settings. These settings cannot be changed during lifecycle of session.- Specified by:
 getStaticSettingsin classSession- Returns:
 - static settings
 
 - 
getDynamicSettings
Description copied from class:SessionReturns dynamic settings. These settings can be changed during lifecycle of session.- Specified by:
 getDynamicSettingsin classSession- Returns:
 - dynamic settings
 
 - 
currentTimestamp
public org.h2.value.ValueTimestampTimeZone currentTimestamp()Description copied from interface:CastDataProviderReturns the current timestamp with maximum resolution. The value must be the same within a transaction or within execution of a command.- Specified by:
 currentTimestampin interfaceCastDataProvider- Returns:
 - the current timestamp for CURRENT_TIMESTAMP(9)
 
 - 
currentTimeZone
public org.h2.util.TimeZoneProvider currentTimeZone()Description copied from interface:CastDataProviderReturns the current time zone.- Specified by:
 currentTimeZonein interfaceCastDataProvider- Returns:
 - the current time zone
 
 - 
getMode
Description copied from interface:CastDataProviderReturns the database mode.- Specified by:
 getModein interfaceCastDataProvider- Returns:
 - the database mode
 
 - 
getDatabaseMeta
public org.h2.jdbc.meta.DatabaseMeta getDatabaseMeta()Description copied from class:SessionReturns database meta information.- Specified by:
 getDatabaseMetain classSession- Returns:
 - database meta information
 
 - 
isOldInformationSchema
public boolean isOldInformationSchema()Description copied from class:SessionReturns whether INFORMATION_SCHEMA contains old-style tables.- Specified by:
 isOldInformationSchemain classSession- Returns:
 - whether INFORMATION_SCHEMA contains old-style tables
 
 - 
zeroBasedEnums
public boolean zeroBasedEnums()Description copied from interface:CastDataProviderReturns are ENUM values 0-based.- Specified by:
 zeroBasedEnumsin interfaceCastDataProvider- Returns:
 - are ENUM values 0-based
 
 - 
readSessionState
public void readSessionState()Read the session state if necessary. 
 -