org.h2.engine

## Class Database

- java.lang.Object
- - org.h2.engine.Database

All Implemented Interfaces:
  CastDataProvider, DataHandler

    public class Database
    extends java.lang.Object
    implements DataHandler, CastDataProvider

There is one database object per open database. The format of the meta data table is: id int, 0, objectType int, sql varchar

Since:
  2004-04-15 22:49

### Constructor Summary

Constructors
Constructor and Description
`Database(ConnectionInfo ci, java.lang.String cipher)`

### Method Summary

Methods
`void` `addDatabaseObject(Session session, DbObject obj)` Add an object to the database.
`void` `addSchemaObject(Session session, SchemaObject obj)` Add a schema object to the database.
`int` `allocateObjectId()` Allocate a new object id.
`boolean` `areEqual(Value a, Value b)` Check if two values are equal with the current comparison mode.
`void` `checkpoint()` Flush all changes and open a new transaction log.
`void` `checkPowerOff()` Check if the simulated power failure occurred.
`void` `checkWritingAllowed()` Check if writing is allowed.
`int` `compare(Value a, Value b)` Compare two values with the current comparison mode.
`int` `compareTypeSafe(Value a, Value b)` Compare two values with the current comparison mode.
`int` `compareWithNull(Value a, Value b, boolean forEquality)` Compare two values with the current comparison mode.
`Row` `createRow(Value[] data, int memory)` Create a new row for a table.
`java.lang.String` `createTempFile()` Create a temporary file in the database folder.
`ValueTimestampTimeZone` `currentTimestamp()` Returns the current timestamp with maximum resolution.
`boolean` `equalsIdentifiers(java.lang.String a, java.lang.String b)` Compare two identifiers (table names, column names,...) and verify they are equal.
`void` `exceptionThrown(java.sql.SQLException e, java.lang.String sql)` This method is called after an exception occurred, to inform the database event listener (if one is set).
`UserAggregate` `findAggregate(java.lang.String name)` Get the user defined aggregate function if it exists, or null if not.
`Comment` `findComment(DbObject object)` Get the comment for the given database object if one exists, or null if not.
`Domain` `findDomain(java.lang.String name)` Get the domain if it exists, or null if not.
`Role` `findRole(java.lang.String roleName)` Get the role if it exists, or null if not.
`Schema` `findSchema(java.lang.String schemaName)` Get the schema if it exists, or null if not.
`Setting` `findSetting(java.lang.String name)` Get the setting if it exists, or null if not.
`User` `findUser(java.lang.String name)` Get the user if it exists, or null if not.
`void` `flush()` Flush all pending changes to the transaction log.
`java.util.ArrayList<UserAggregate>` `getAllAggregates()`
`java.util.ArrayList<Comment>` `getAllComments()`
`java.util.Collection<Domain>` `getAllDomains()`
`int` `getAllowLiterals()`
`java.util.ArrayList<Right>` `getAllRights()`
`java.util.ArrayList<Role>` `getAllRoles()`
`java.util.ArrayList<SchemaObject>` `getAllSchemaObjects()` Get all schema objects.
`java.util.ArrayList<SchemaObject>` `getAllSchemaObjects(int type)` Get all schema objects of the given type.
`java.util.Collection<Schema>` `getAllSchemas()`
`java.util.Collection<Setting>` `getAllSettings()`
`java.util.ArrayList<TableSynonym>` `getAllSynonyms()` Get all synonyms.
`java.util.ArrayList<Table>` `getAllTablesAndViews(boolean includeMeta)` Get all tables and views.
`java.util.Collection<User>` `getAllUsers()`
`Authenticator` `getAuthenticator()` get authenticator for database users
`java.lang.Throwable` `getBackgroundException()`
`java.lang.String` `getCacheType()`
`java.lang.String` `getCluster()`
`CompareMode` `getCompareMode()` Return compare mode.
`SourceCompiler` `getCompiler()`
`java.lang.String` `getDatabasePath()` Get the database path.
`int` `getDefaultTableType()`
`Table` `getDependentTable(SchemaObject obj, Table except)` Get the first table that depends on this object.
`Session` `getExclusiveSession()`
`byte[]` `getFileEncryptionKey()`
`Table` `getFirstUserTable()` Get the first user defined table, excluding the LOB_BLOCKS table that the Recover tool creates.
`boolean` `getFlushOnEachCommit()` Check if flush-on-each-commit is enabled.
`boolean` `getIgnoreCase()`
`boolean` `getIgnoreCatalogs()`
`java.util.ArrayList<InDoubtTransaction>` `getInDoubtTransactions()` Get the list of in-doubt transactions.
`JavaObjectSerializer` `getJavaObjectSerializer()` Return the serializer to be used for java objects being stored in column of type OTHER.
`TableLinkConnection` `getLinkConnection(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password)` Open a new connection or get an existing connection to another database.
`java.lang.String` `getLobCompressionAlgorithm(int type)` Get the compression algorithm used for large objects.
`JdbcConnection` `getLobConnectionForInit()`
`JdbcConnection` `getLobConnectionForRegularUse()`
`SmallLRUCache<java.lang.String,java.lang.String[]>` `getLobFileListCache()` Get the lob file list cache if it is used.
`Session` `getLobSession()`
`LobStorageInterface` `getLobStorage()` Get the lob storage mechanism to use.
`java.lang.Object` `getLobSyncObject()` Get the synchronization object for lob operations.
`int` `getLockMode()`
`int` `getLockTimeout()`
`int` `getLogMode()`
`Schema` `getMainSchema()` Returns main schema (usually PUBLIC).
`int` `getMaxLengthInplaceLob()` Get the maximum length of a in-place large object
`int` `getMaxMemoryRows()`
`int` `getMaxMemoryUndo()`
`int` `getMaxOperationMemory()`
`Mode` `getMode()` Returns the database mode.
`long` `getModificationDataId()`
`long` `getModificationMetaId()`
`java.lang.String` `getName()`
`long` `getNextModificationDataId()`
`long` `getNextModificationMetaId()`
`boolean` `getOptimizeReuseResults()`
`int` `getPageSize()`
`PageStore` `getPageStore()`
`int` `getPowerOffCount()`
`Role` `getPublicRole()`
`boolean` `getQueryStatistics()`
`QueryStatisticsData` `getQueryStatisticsData()`
`boolean` `getReferentialIntegrity()`
`LocalResultFactory` `getResultFactory()`
`int` `getRetentionTime()`
`RowFactory` `getRowFactory()`
`Schema` `getSchema(java.lang.String schemaName)` Get the schema.
`int` `getSessionCount()`
`Session[]` `getSessions(boolean includingSystemSession)` Get all sessions that are currently connected to the database.
`DbSettings` `getSettings()`
`java.lang.String` `getShortName()`
`MVTableEngine.Store` `getStore()`
`Session` `getSystemSession()`
`TableEngine` `getTableEngine(java.lang.String tableEngine)` Get the table engine class, loading it if needed.
`java.util.ArrayList<Table>` `getTableOrViewByName(java.lang.String name)` Get the tables with the given name, if any.
`TempFileDeleter` `getTempFileDeleter()` Get the temp file deleter mechanism.
`java.lang.String` `getTempTableName(java.lang.String baseName, Session session)` Get a unique temporary table name.
`Trace` `getTrace(int moduleId)` Get the trace object for the given module id.
`TraceSystem` `getTraceSystem()`
`User` `getUser(java.lang.String name)` Get user with the given name.
`boolean` `isAllowBuiltinAliasOverride()`
`boolean` `isClosing()` Check if the database is in the process of closing.
`boolean` `isMVStore()` Check if MVStore backend is used for this database.
`boolean` `isPersistent()` Check if this database is disk-based.
`boolean` `isReadOnly()`
`boolean` `isStarting()` Check if the database is currently opening.
`boolean` `isSysTableLocked()` Checks if the system table (containing the catalog) is locked.
`boolean` `isSysTableLockedBy(Session session)` Checks if the system table (containing the catalog) is locked by the given session.
`boolean` `lockMeta(Session session)` Lock the metadata table for updates.
`<V> java.util.concurrent.ConcurrentHashMap<java.lang.String,V>` `newConcurrentStringMap()` Create a new hash map.
`<V> java.util.HashMap<java.lang.String,V>` `newStringMap()` Create a new hash map.
`FileStore` `openFile(java.lang.String name, java.lang.String openMode, boolean mustExist)` Open a file at the given location.
`int` `readLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length)` Read from a lob.
`void` `removeDatabaseObject(Session session, DbObject obj)` Remove the object from the database.
`void` `removeMeta(Session session, int id)` Remove the given object from the meta data.
`void` `removeSchemaObject(Session session, SchemaObject obj)` Remove an object from the system table.
`void` `removeSession(Session session)` Remove a session.
`void` `renameDatabaseObject(Session session, DbObject obj, java.lang.String newName)` Rename a database object.
`void` `renameSchemaObject(Session session, SchemaObject obj, java.lang.String newName)` Rename a schema object.
`void` `setAllowBuiltinAliasOverride(boolean b)`
`void` `setAllowLiterals(int value)`
`void` `setAuthenticator(Authenticator authenticator)` Set current database authenticator
`void` `setBackgroundException(DbException e)`
`void` `setCacheSize(int kb)`
`void` `setCloseDelay(int value)`
`void` `setCluster(java.lang.String cluster)`
`void` `setCompactMode(int compactMode)`
`void` `setCompareMode(CompareMode compareMode)`
`void` `setDefaultTableType(int defaultTableType)`
`void` `setDeleteFilesOnDisconnect(boolean b)`
`void` `setEventListener(DatabaseEventListener eventListener)`
`void` `setEventListenerClass(java.lang.String className)`
`boolean` `setExclusiveSession(Session session, boolean closeOthers)` Set the session that can exclusively access the database.
`void` `setIgnoreCase(boolean b)`
`void` `setIgnoreCatalogs(boolean b)`
`static void` `setInitialPowerOffCount(int count)`
`void` `setJavaObjectSerializerName(java.lang.String serializerName)`
`void` `setLobCompressionAlgorithm(java.lang.String stringValue)`
`void` `setLockMode(int lockMode)`
`void` `setLogMode(int log)`
`void` `setMasterUser(User user)`
`void` `setMaxLengthInplaceLob(int value)`
`void` `setMaxLogSize(long value)`
`void` `setMaxMemoryRows(int value)`
`void` `setMaxMemoryUndo(int value)`
`void` `setMaxOperationMemory(int maxOperationMemory)`
`void` `setMode(Mode mode)`
`void` `setOptimizeReuseResults(boolean b)`
`void` `setPowerOffCount(int count)`
`void` `setProgress(int state, java.lang.String name, int x, int max)` Set the progress of a long running operation.
`void` `setQueryStatistics(boolean b)`
`void` `setQueryStatisticsMaxEntries(int n)`
`void` `setReadOnly(boolean readOnly)` Switch the database to read-only mode.
`void` `setReferentialIntegrity(boolean b)`
`void` `setResultFactory(LocalResultFactory resultFactory)`
`void` `setRetentionTime(int value)`
`void` `setRowFactory(RowFactory rowFactory)`
`void` `setStore(MVTableEngine.Store store)`
`void` `setWriteDelay(int value)`
`void` `shutdownImmediately()` Immediately close the database.
`void` `sync()` Synchronize the files with the file system.
`java.lang.String` `sysIdentifier(java.lang.String upperName)` Returns identifier in upper or lower case depending on database settings.
`java.lang.String` `toString()`
`void` `unlockMeta(Session session)` Unlock the metadata table.
`void` `unlockMetaDebug(Session session)` This method doesn't actually unlock the metadata table, all it does it reset the debugging flags.
`boolean` `unsetExclusiveSession(Session session)` Stop exclusive access the database by provided session.
`void` `updateMeta(Session session, DbObject obj)` Update an object in the system table.
`void` `verifyMetaLocked(Session session)` Verify the meta table is locked.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Database

    public Database(ConnectionInfo ci,
            java.lang.String cipher)

### Method Detail

#### getLockTimeout

    public int getLockTimeout()

#### createRow

    public Row createRow(Value[] data,
                int memory)

Create a new row for a table.

Parameters:
  `data` - the values
  `memory` - whether the row is in memory
Returns:
  the created row

#### getRowFactory

    public RowFactory getRowFactory()

#### setRowFactory

    public void setRowFactory(RowFactory rowFactory)

#### getResultFactory

    public LocalResultFactory getResultFactory()

#### setResultFactory

    public void setResultFactory(LocalResultFactory resultFactory)

#### setInitialPowerOffCount

    public static void setInitialPowerOffCount(int count)

#### setPowerOffCount

    public void setPowerOffCount(int count)

#### getStore

    public MVTableEngine.Store getStore()

#### setStore

    public void setStore(MVTableEngine.Store store)

#### areEqual

    public boolean areEqual(Value a,
                   Value b)

Check if two values are equal with the current comparison mode.

Parameters:
  `a` - the first value
  `b` - the second value
Returns:
  true if both objects are equal

#### compare

    public int compare(Value a,
              Value b)

Compare two values with the current comparison mode. The values may have different data types including NULL.

Parameters:
  `a` - the first value
  `b` - the second value
Returns:
  0 if both values are equal, -1 if the first value is smaller, and 1 otherwise

#### compareWithNull

    public int compareWithNull(Value a,
                      Value b,
                      boolean forEquality)

Compare two values with the current comparison mode. The values may have different data types including NULL.

Parameters:
  `a` - the first value
  `b` - the second value
  `forEquality` - perform only check for equality (= or <>)
Returns:
  0 if both values are equal, -1 if the first value is smaller, 1 if the second value is larger, `Integer.MIN_VALUE` if order is not defined due to NULL comparison

#### compareTypeSafe

    public int compareTypeSafe(Value a,
                      Value b)

Compare two values with the current comparison mode. The values must be of the same type.

Parameters:
  `a` - the first value
  `b` - the second value
Returns:
  0 if both values are equal, -1 if the first value is smaller, and 1 otherwise

#### getModificationDataId

    public long getModificationDataId()

#### getNextModificationDataId

    public long getNextModificationDataId()

#### getModificationMetaId

    public long getModificationMetaId()

#### getNextModificationMetaId

    public long getNextModificationMetaId()

#### getPowerOffCount

    public int getPowerOffCount()

#### checkPowerOff

    public void checkPowerOff()

Description copied from interface: `DataHandler`
Check if the simulated power failure occurred. This call will decrement the countdown.

Specified by:
  `checkPowerOff` in interface `DataHandler`

#### getTrace

    public Trace getTrace(int moduleId)

Get the trace object for the given module id.

Parameters:
  `moduleId` - the module id
Returns:
  the trace object

#### openFile

    public FileStore openFile(java.lang.String name,
                     java.lang.String openMode,
                     boolean mustExist)

Description copied from interface: `DataHandler`
Open a file at the given location.

Specified by:
  `openFile` in interface `DataHandler`
Parameters:
  `name` - the file name
  `openMode` - the mode
  `mustExist` - whether the file must already exist
Returns:
  the file

#### verifyMetaLocked

    public void verifyMetaLocked(Session session)

Verify the meta table is locked.

Parameters:
  `session` - the session

#### lockMeta

    public boolean lockMeta(Session session)

Lock the metadata table for updates.

Parameters:
  `session` - the session
Returns:
  whether it was already locked before by this session

#### unlockMeta

    public void unlockMeta(Session session)

Unlock the metadata table.

Parameters:
  `session` - the session

#### unlockMetaDebug

    public void unlockMetaDebug(Session session)

This method doesn't actually unlock the metadata table, all it does it reset the debugging flags.

Parameters:
  `session` - the session

#### removeMeta

    public void removeMeta(Session session,
                  int id)

Remove the given object from the meta data.

Parameters:
  `session` - the session
  `id` - the id of the object to remove

#### addSchemaObject

    public void addSchemaObject(Session session,
                       SchemaObject obj)

Add a schema object to the database.

Parameters:
  `session` - the session
  `obj` - the object to add

#### addDatabaseObject

    public void addDatabaseObject(Session session,
                         DbObject obj)

Add an object to the database.

Parameters:
  `session` - the session
  `obj` - the object to add

#### findAggregate

    public UserAggregate findAggregate(java.lang.String name)

Get the user defined aggregate function if it exists, or null if not.

Parameters:
  `name` - the name of the user defined aggregate function
Returns:
  the aggregate function or null

#### findComment

    public Comment findComment(DbObject object)

Get the comment for the given database object if one exists, or null if not.

Parameters:
  `object` - the database object
Returns:
  the comment or null

#### findRole

    public Role findRole(java.lang.String roleName)

Get the role if it exists, or null if not.

Parameters:
  `roleName` - the name of the role
Returns:
  the role or null

#### findSchema

    public Schema findSchema(java.lang.String schemaName)

Get the schema if it exists, or null if not.

Parameters:
  `schemaName` - the name of the schema
Returns:
  the schema or null

#### findSetting

    public Setting findSetting(java.lang.String name)

Get the setting if it exists, or null if not.

Parameters:
  `name` - the name of the setting
Returns:
  the setting or null

#### findUser

    public User findUser(java.lang.String name)

Get the user if it exists, or null if not.

Parameters:
  `name` - the name of the user
Returns:
  the user or null

#### findDomain

    public Domain findDomain(java.lang.String name)

Get the domain if it exists, or null if not.

Parameters:
  `name` - the name of the domain
Returns:
  the domain or null

#### getUser

    public User getUser(java.lang.String name)

Get user with the given name. This method throws an exception if the user does not exist.

Parameters:
  `name` - the user name
Returns:
  the user
Throws:
  `DbException` - if the user does not exist

#### removeSession

    public void removeSession(Session session)

Remove a session. This method is called after the user has disconnected.

Parameters:
  `session` - the session

#### allocateObjectId

    public int allocateObjectId()

Allocate a new object id.

Returns:
  the id

#### getMainSchema

    public Schema getMainSchema()

Returns main schema (usually PUBLIC).

Returns:
  main schema (usually PUBLIC)

#### getAllAggregates

    public java.util.ArrayList<UserAggregate> getAllAggregates()

#### getAllComments

    public java.util.ArrayList<Comment> getAllComments()

#### getAllowLiterals

    public int getAllowLiterals()

#### getAllRights

    public java.util.ArrayList<Right> getAllRights()

#### getAllRoles

    public java.util.ArrayList<Role> getAllRoles()

#### getAllSchemaObjects

    public java.util.ArrayList<SchemaObject> getAllSchemaObjects()

Get all schema objects.

Returns:
  all objects of all types

#### getAllSchemaObjects

    public java.util.ArrayList<SchemaObject> getAllSchemaObjects(int type)

Get all schema objects of the given type.

Parameters:
  `type` - the object type
Returns:
  all objects of that type

#### getAllTablesAndViews

    public java.util.ArrayList<Table> getAllTablesAndViews(boolean includeMeta)

Get all tables and views.

Parameters:
  `includeMeta` - whether to force including the meta data tables (if true, metadata tables are always included; if false, metadata tables are only included if they are already initialized)
Returns:
  all objects of that type

#### getAllSynonyms

    public java.util.ArrayList<TableSynonym> getAllSynonyms()

Get all synonyms.

Returns:
  all objects of that type

#### getTableOrViewByName

    public java.util.ArrayList<Table> getTableOrViewByName(java.lang.String name)

Get the tables with the given name, if any.

Parameters:
  `name` - the table name
Returns:
  the list

#### getAllSchemas

    public java.util.Collection<Schema> getAllSchemas()

#### getAllSettings

    public java.util.Collection<Setting> getAllSettings()

#### getAllDomains

    public java.util.Collection<Domain> getAllDomains()

#### getAllUsers

    public java.util.Collection<User> getAllUsers()

#### getCacheType

    public java.lang.String getCacheType()

#### getCluster

    public java.lang.String getCluster()

#### getCompareMode

    public CompareMode getCompareMode()

Description copied from interface: `DataHandler`
Return compare mode.

Specified by:
  `getCompareMode` in interface `DataHandler`
Returns:
  Compare mode.

#### getDatabasePath

    public java.lang.String getDatabasePath()

Description copied from interface: `DataHandler`
Get the database path.

Specified by:
  `getDatabasePath` in interface `DataHandler`
Returns:
  the database path

#### getShortName

    public java.lang.String getShortName()

#### getName

    public java.lang.String getName()

#### getSessions

    public Session[] getSessions(boolean includingSystemSession)

Get all sessions that are currently connected to the database.

Parameters:
  `includingSystemSession` - if the system session should also be included
Returns:
  the list of sessions

#### updateMeta

    public void updateMeta(Session session,
                  DbObject obj)

Update an object in the system table.

Parameters:
  `session` - the session
  `obj` - the database object

#### renameSchemaObject

    public void renameSchemaObject(Session session,
                          SchemaObject obj,
                          java.lang.String newName)

Rename a schema object.

Parameters:
  `session` - the session
  `obj` - the object
  `newName` - the new name

#### renameDatabaseObject

    public void renameDatabaseObject(Session session,
                            DbObject obj,
                            java.lang.String newName)

Rename a database object.

Parameters:
  `session` - the session
  `obj` - the object
  `newName` - the new name

#### createTempFile

    public java.lang.String createTempFile()

Create a temporary file in the database folder.

Returns:
  the file name

#### getSchema

    public Schema getSchema(java.lang.String schemaName)

Get the schema. If the schema does not exist, an exception is thrown.

Parameters:
  `schemaName` - the name of the schema
Returns:
  the schema
Throws:
  `DbException` - no schema with that name exists

#### removeDatabaseObject

    public void removeDatabaseObject(Session session,
                            DbObject obj)

Remove the object from the database.

Parameters:
  `session` - the session
  `obj` - the object to remove

#### getDependentTable

    public Table getDependentTable(SchemaObject obj,
                          Table except)

Get the first table that depends on this object.

Parameters:
  `obj` - the object to find
  `except` - the table to exclude (or null)
Returns:
  the first dependent table, or null

#### removeSchemaObject

    public void removeSchemaObject(Session session,
                          SchemaObject obj)

Remove an object from the system table.

Parameters:
  `session` - the session
  `obj` - the object to be removed

#### isPersistent

    public boolean isPersistent()

Check if this database is disk-based.

Returns:
  true if it is disk-based, false if it is in-memory only.

#### getTraceSystem

    public TraceSystem getTraceSystem()

#### setCacheSize

    public void setCacheSize(int kb)

#### setMasterUser

    public void setMasterUser(User user)

#### getPublicRole

    public Role getPublicRole()

#### getTempTableName

    public java.lang.String getTempTableName(java.lang.String baseName,
                                    Session session)

Get a unique temporary table name.

Parameters:
  `baseName` - the prefix of the returned name
  `session` - the session
Returns:
  a unique name

#### setCompareMode

    public void setCompareMode(CompareMode compareMode)

#### setCluster

    public void setCluster(java.lang.String cluster)

#### checkWritingAllowed

    public void checkWritingAllowed()

Description copied from interface: `DataHandler`
Check if writing is allowed.

Specified by:
  `checkWritingAllowed` in interface `DataHandler`

#### isReadOnly

    public boolean isReadOnly()

#### setWriteDelay

    public void setWriteDelay(int value)

#### getRetentionTime

    public int getRetentionTime()

#### setRetentionTime

    public void setRetentionTime(int value)

#### setAllowBuiltinAliasOverride

    public void setAllowBuiltinAliasOverride(boolean b)

#### isAllowBuiltinAliasOverride

    public boolean isAllowBuiltinAliasOverride()

#### getFlushOnEachCommit

    public boolean getFlushOnEachCommit()

Check if flush-on-each-commit is enabled.

Returns:
  true if it is

#### getInDoubtTransactions

    public java.util.ArrayList<InDoubtTransaction> getInDoubtTransactions()

Get the list of in-doubt transactions.

Returns:
  the list

#### setBackgroundException

    public void setBackgroundException(DbException e)

#### getBackgroundException

    public java.lang.Throwable getBackgroundException()

#### flush

    public void flush()

Flush all pending changes to the transaction log.

#### setEventListener

    public void setEventListener(DatabaseEventListener eventListener)

#### setEventListenerClass

    public void setEventListenerClass(java.lang.String className)

#### setProgress

    public void setProgress(int state,
                   java.lang.String name,
                   int x,
                   int max)

Set the progress of a long running operation. This method calls the `DatabaseEventListener` if one is registered.

Parameters:
  `state` - the `DatabaseEventListener` state
  `name` - the object name
  `x` - the current position
  `max` - the highest value

#### exceptionThrown

    public void exceptionThrown(java.sql.SQLException e,
                       java.lang.String sql)

This method is called after an exception occurred, to inform the database event listener (if one is set).

Parameters:
  `e` - the exception
  `sql` - the SQL statement

#### sync

    public void sync()

Synchronize the files with the file system. This method is called when executing the SQL statement CHECKPOINT SYNC.

#### getMaxMemoryRows

    public int getMaxMemoryRows()

#### setMaxMemoryRows

    public void setMaxMemoryRows(int value)

#### setMaxMemoryUndo

    public void setMaxMemoryUndo(int value)

#### getMaxMemoryUndo

    public int getMaxMemoryUndo()

#### setLockMode

    public void setLockMode(int lockMode)

#### getLockMode

    public int getLockMode()

#### setCloseDelay

    public void setCloseDelay(int value)

#### getSystemSession

    public Session getSystemSession()

#### isClosing

    public boolean isClosing()

Check if the database is in the process of closing.

Returns:
  true if the database is closing

#### setMaxLengthInplaceLob

    public void setMaxLengthInplaceLob(int value)

#### getMaxLengthInplaceLob

    public int getMaxLengthInplaceLob()

Description copied from interface: `DataHandler`
Get the maximum length of a in-place large object

Specified by:
  `getMaxLengthInplaceLob` in interface `DataHandler`
Returns:
  the maximum size

#### setIgnoreCase

    public void setIgnoreCase(boolean b)

#### getIgnoreCase

    public boolean getIgnoreCase()

#### setIgnoreCatalogs

    public void setIgnoreCatalogs(boolean b)

#### getIgnoreCatalogs

    public boolean getIgnoreCatalogs()

#### setDeleteFilesOnDisconnect

    public void setDeleteFilesOnDisconnect(boolean b)

#### getLobCompressionAlgorithm

    public java.lang.String getLobCompressionAlgorithm(int type)

Description copied from interface: `DataHandler`
Get the compression algorithm used for large objects.

Specified by:
  `getLobCompressionAlgorithm` in interface `DataHandler`
Parameters:
  `type` - the data type (CLOB or BLOB)
Returns:
  the compression algorithm, or null

#### setLobCompressionAlgorithm

    public void setLobCompressionAlgorithm(java.lang.String stringValue)

#### setMaxLogSize

    public void setMaxLogSize(long value)

#### setAllowLiterals

    public void setAllowLiterals(int value)

#### getOptimizeReuseResults

    public boolean getOptimizeReuseResults()

#### setOptimizeReuseResults

    public void setOptimizeReuseResults(boolean b)

#### getLobSyncObject

    public java.lang.Object getLobSyncObject()

Description copied from interface: `DataHandler`
Get the synchronization object for lob operations.

Specified by:
  `getLobSyncObject` in interface `DataHandler`
Returns:
  the synchronization object

#### getSessionCount

    public int getSessionCount()

#### setReferentialIntegrity

    public void setReferentialIntegrity(boolean b)

#### getReferentialIntegrity

    public boolean getReferentialIntegrity()

#### setQueryStatistics

    public void setQueryStatistics(boolean b)

#### getQueryStatistics

    public boolean getQueryStatistics()

#### setQueryStatisticsMaxEntries

    public void setQueryStatisticsMaxEntries(int n)

#### getQueryStatisticsData

    public QueryStatisticsData getQueryStatisticsData()

#### isStarting

    public boolean isStarting()

Check if the database is currently opening. This is true until all stored SQL statements have been executed.

Returns:
  true if the database is still starting

#### isMVStore

    public boolean isMVStore()

Check if MVStore backend is used for this database.

Returns:
  `true` for MVStore, `false` for PageStore

#### setMode

    public void setMode(Mode mode)

#### getMode

    public Mode getMode()

Description copied from interface: `CastDataProvider`
Returns the database mode.

Specified by:
  `getMode` in interface `CastDataProvider`
Returns:
  the database mode

#### setMaxOperationMemory

    public void setMaxOperationMemory(int maxOperationMemory)

#### getMaxOperationMemory

    public int getMaxOperationMemory()

#### getExclusiveSession

    public Session getExclusiveSession()

#### setExclusiveSession

    public boolean setExclusiveSession(Session session,
                              boolean closeOthers)

Set the session that can exclusively access the database.

Parameters:
  `session` - the session
  `closeOthers` - whether other sessions are closed
Returns:
  true if success, false otherwise

#### unsetExclusiveSession

    public boolean unsetExclusiveSession(Session session)

Stop exclusive access the database by provided session.

Parameters:
  `session` - the session
Returns:
  true if success, false otherwise

#### getLobFileListCache

    public SmallLRUCache<java.lang.String,java.lang.String[]> getLobFileListCache()

Description copied from interface: `DataHandler`
Get the lob file list cache if it is used.

Specified by:
  `getLobFileListCache` in interface `DataHandler`
Returns:
  the cache or null

#### isSysTableLocked

    public boolean isSysTableLocked()

Checks if the system table (containing the catalog) is locked.

Returns:
  true if it is currently locked

#### isSysTableLockedBy

    public boolean isSysTableLockedBy(Session session)

Checks if the system table (containing the catalog) is locked by the given session.

Parameters:
  `session` - the session
Returns:
  true if it is currently locked

#### getLinkConnection

    public TableLinkConnection getLinkConnection(java.lang.String driver,
                                        java.lang.String url,
                                        java.lang.String user,
                                        java.lang.String password)

Open a new connection or get an existing connection to another database.

Parameters:
  `driver` - the database driver or null
  `url` - the database URL
  `user` - the user name
  `password` - the password
Returns:
  the connection

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### shutdownImmediately

    public void shutdownImmediately()

Immediately close the database.

#### getTempFileDeleter

    public TempFileDeleter getTempFileDeleter()

Description copied from interface: `DataHandler`
Get the temp file deleter mechanism.

Specified by:
  `getTempFileDeleter` in interface `DataHandler`
Returns:
  the temp file deleter

#### getPageStore

    public PageStore getPageStore()

#### getFirstUserTable

    public Table getFirstUserTable()

Get the first user defined table, excluding the LOB_BLOCKS table that the Recover tool creates.

Returns:
  the table or null if no table is defined

#### checkpoint

    public void checkpoint()

Flush all changes and open a new transaction log.

#### setReadOnly

    public void setReadOnly(boolean readOnly)

Switch the database to read-only mode.

Parameters:
  `readOnly` - the new value

#### setCompactMode

    public void setCompactMode(int compactMode)

#### getCompiler

    public SourceCompiler getCompiler()

#### getLobStorage

    public LobStorageInterface getLobStorage()

Description copied from interface: `DataHandler`
Get the lob storage mechanism to use.

Specified by:
  `getLobStorage` in interface `DataHandler`
Returns:
  the lob storage mechanism

#### getLobConnectionForInit

    public JdbcConnection getLobConnectionForInit()

#### getLobConnectionForRegularUse

    public JdbcConnection getLobConnectionForRegularUse()

#### getLobSession

    public Session getLobSession()

#### setLogMode

    public void setLogMode(int log)

#### getLogMode

    public int getLogMode()

#### getDefaultTableType

    public int getDefaultTableType()

#### setDefaultTableType

    public void setDefaultTableType(int defaultTableType)

#### getSettings

    public DbSettings getSettings()

#### newStringMap

    public <V> java.util.HashMap<java.lang.String,V> newStringMap()

Create a new hash map. Depending on the configuration, the key is case sensitive or case insensitive.

Type Parameters:
  `V` - the value type
Returns:
  the hash map

#### newConcurrentStringMap

    public <V> java.util.concurrent.ConcurrentHashMap<java.lang.String,V> newConcurrentStringMap()

Create a new hash map. Depending on the configuration, the key is case sensitive or case insensitive.

Type Parameters:
  `V` - the value type
Returns:
  the hash map

#### equalsIdentifiers

    public boolean equalsIdentifiers(java.lang.String a,
                            java.lang.String b)

Compare two identifiers (table names, column names,...) and verify they are equal. Case sensitivity depends on the configuration.

Parameters:
  `a` - the first identifier
  `b` - the second identifier
Returns:
  true if they match

#### sysIdentifier

    public java.lang.String sysIdentifier(java.lang.String upperName)

Returns identifier in upper or lower case depending on database settings.

Parameters:
  `upperName` - identifier in the upper case
Returns:
  identifier in upper or lower case

#### readLob

    public int readLob(long lobId,
              byte[] hmac,
              long offset,
              byte[] buff,
              int off,
              int length)

Description copied from interface: `DataHandler`
Read from a lob.

Specified by:
  `readLob` in interface `DataHandler`
Parameters:
  `lobId` - the lob id
  `hmac` - the message authentication code
  `offset` - the offset within the lob
  `buff` - the target buffer
  `off` - the offset within the target buffer
  `length` - the number of bytes to read
Returns:
  the number of bytes read

#### getFileEncryptionKey

    public byte[] getFileEncryptionKey()

#### getPageSize

    public int getPageSize()

#### getJavaObjectSerializer

    public JavaObjectSerializer getJavaObjectSerializer()

Description copied from interface: `DataHandler`
Return the serializer to be used for java objects being stored in column of type OTHER.

Specified by:
  `getJavaObjectSerializer` in interface `DataHandler`
Returns:
  the serializer to be used for java objects being stored in column of type OTHER

#### setJavaObjectSerializerName

    public void setJavaObjectSerializerName(java.lang.String serializerName)

#### getTableEngine

    public TableEngine getTableEngine(java.lang.String tableEngine)

Get the table engine class, loading it if needed.

Parameters:
  `tableEngine` - the table engine name
Returns:
  the class

#### getAuthenticator

    public Authenticator getAuthenticator()

get authenticator for database users

Returns:
  authenticator set for database

#### setAuthenticator

    public void setAuthenticator(Authenticator authenticator)

Set current database authenticator

Parameters:
  `authenticator` - = authenticator to set, null to revert to the Internal authenticator

#### currentTimestamp

    public ValueTimestampTimeZone currentTimestamp()

Description copied from interface: `CastDataProvider`
Returns the current timestamp with maximum resolution. The value must be the same within a transaction or within execution of a command.

Specified by:
  `currentTimestamp` in interface `CastDataProvider`
Returns:
  the current timestamp for CURRENT_TIMESTAMP(9)