Package org.h2.engine

# Class Database

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

All Implemented Interfaces:
  `CastDataProvider`, `DataHandler`

public final class Database extends Object implements DataHandler, CastDataProvider
There is one database object per open database.

The format of the metadata table is: id int, 0, objectType int, sql varchar

Since:
  2004-04-15 22:49

## Constructor Summary

Constructors
Constructor
Description
`Database(ConnectionInfo ci, String cipher)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addDatabaseObject(SessionLocal session, DbObject obj)`
Add an object to the database.
`void`
`addSchemaObject(SessionLocal session, SchemaObject obj)`
Add a schema object to the database.
`int`
`allocateObjectId()`
Allocate a new object id.
`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.
`ValueTimestampTimeZone`
`currentTimestamp()`
Returns the current timestamp with maximum resolution.
`TimeZoneProvider`
`currentTimeZone()`
Returns the current time zone.
`boolean`
`equalsIdentifiers(String a, String b)`
Compare two identifiers (table names, column names,...) and verify they are equal.
`void`
`exceptionThrown(SQLException e, String sql)`
This method is called after an exception occurred, to inform the database event listener (if one is set).
`Comment`
`findComment(DbObject object)`
Get the comment for the given database object if one exists, or null if not.
`Role`
`findRole(String roleName)`
Get the role if it exists, or null if not.
`Schema`
`findSchema(String schemaName)`
Get the schema if it exists, or null if not.
`Setting`
`findSetting(String name)`
Get the setting if it exists, or null if not.
`User`
`findUser(String name)`
Get the user if it exists, or null if not.
`RightOwner`
`findUserOrRole(String name)`
Get the user or role if it exists, or `null` if not.
`void`
`flush()`
Flush all pending changes to the transaction log.
`ArrayList<Comment>`
`getAllComments()`
`int`
`getAllowLiterals()`
`ArrayList<Right>`
`getAllRights()`
`Collection<Schema>`
`getAllSchemas()`
`Collection<Schema>`
`getAllSchemasNoMeta()`
`Collection<Setting>`
`getAllSettings()`
`ArrayList<TableSynonym>`
`getAllSynonyms()`
Get all synonyms.
`ArrayList<Table>`
`getAllTablesAndViews()`
Get all tables and views.
`Collection<RightOwner>`
`getAllUsersAndRoles()`
`Authenticator`
`getAuthenticator()`
get authenticator for database users
`Throwable`
`getBackgroundException()`
`String`
`getCacheType()`
`String`
`getCluster()`
`CompareMode`
`getCompareMode()`
Return compare mode.
`SourceCompiler`
`getCompiler()`
`String`
`getDatabasePath()`
Get the database path.
`DefaultNullOrdering`
`getDefaultNullOrdering()`
`int`
`getDefaultTableType()`
`Table`
`getDependentTable(SchemaObject obj, Table except)`
Get the first table that depends on this object.
`SessionLocal`
`getExclusiveSession()`
`Table`
`getFirstUserTable()`
Get the first user defined table, excluding the LOB_BLOCKS table that the Recover tool creates.
`boolean`
`getIgnoreCase()`
`boolean`
`getIgnoreCatalogs()`
`ArrayList<InDoubtTransaction>`
`getInDoubtTransactions()`
Get the list of in-doubt transactions.
`JavaObjectSerializer`
`getJavaObjectSerializer()`
Returns the custom Java object serializer, or `null`.
`TableLinkConnection`
`getLinkConnection(String driver, String url, String user, String password)`
Open a new connection or get an existing connection to another database.
`SmallLRUCache<String,String[]>`
`getLobFileListCache()`
Get the lob file list cache if it is used.
`SessionLocal`
`getLobSession()`
`LobStorageInterface`
`getLobStorage()`
Get the lob storage mechanism to use.
`Object`
`getLobSyncObject()`
Get the synchronization object for lob operations.
`int`
`getLockMode()`
`int`
`getLockTimeout()`
`Schema`
`getMainSchema()`
Returns main schema (usually PUBLIC).
`int`
`getMaxLengthInplaceLob()`
Get the maximum length of in-place large object
`int`
`getMaxMemoryRows()`
`int`
`getMaxOperationMemory()`
`Mode`
`getMode()`
Returns the database mode.
`long`
`getModificationDataId()`
`long`
`getModificationMetaId()`
`String`
`getName()`
`long`
`getNextModificationDataId()`
`long`
`getNextModificationMetaId()`
`long`
`getNextRemoteSettingsId()`
`boolean`
`getOptimizeReuseResults()`
`int`
`getPageSize()`
`int`
`getPowerOffCount()`
`Role`
`getPublicRole()`
`boolean`
`getQueryStatistics()`
`QueryStatisticsData`
`getQueryStatisticsData()`
`boolean`
`getReferentialIntegrity()`
`long`
`getRemoteSettingsId()`
`int`
`getRetentionTime()`
`RowFactory`
`getRowFactory()`
`Schema`
`getSchema(String schemaName)`
Get the schema.
`int`
`getSessionCount()`
`SessionLocal[]`
`getSessions(boolean includingSystemSession)`
Get all sessions that are currently connected to the database.
`DbSettings`
`getSettings()`
`String`
`getShortName()`
`Store`
`getStore()`
`SessionLocal`
`getSystemSession()`
`User`
`getSystemUser()`
Returns system user.
`TableEngine`
`getTableEngine(String tableEngine)`
Get the table engine class, loading it if needed.
`TempFileDeleter`
`getTempFileDeleter()`
Get the temp file deleter mechanism.
`String`
`getTempTableName(String baseName, SessionLocal session)`
Get a unique temporary table name.
`Trace`
`getTrace(int moduleId)`
Get the trace object for the given module id.
`TraceSystem`
`getTraceSystem()`
`User`
`getUser(String name)`
Get user with the given name.
`int`
`getWriteDelay()`
`boolean`
`isAllowBuiltinAliasOverride()`
`boolean`
`isClosing()`
Check if the database is in the process of closing.
`boolean`
`isInExclusiveMode()`
`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(SessionLocal session)`
Checks if the system table (containing the catalog) is locked by the given session.
`boolean`
`lockMeta(SessionLocal session)`
Lock the metadata table for updates.
`<V> ConcurrentHashMap<String,V>`
`newConcurrentStringMap()`
Create a new hash map.
`<V> HashMap<String,V>`
`newStringMap()`
Create a new hash map.
`<V> HashMap<String,V>`
`newStringMap(int initialCapacity)`
Create a new hash map.
`FileStore`
`openFile(String name, String openMode, boolean mustExist)`
Open a file at the given location.
`void`
`populateInfo(BiConsumer<String,String> consumer)`
`int`
`readLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length)`
Read from a lob.
`void`
`releaseDatabaseObjectIds(BitSet idsToRelease)`
Mark some database ids as unused.
`void`
`removeDatabaseObject(SessionLocal session, DbObject obj)`
Remove the object from the database.
`void`
`removeMeta(SessionLocal session, int id)`
Remove the given object from the metadata.
`void`
`removeSchemaObject(SessionLocal session, SchemaObject obj)`
Remove an object from the system table.
`void`
`removeSession(SessionLocal session)`
Remove a session.
`void`
`renameDatabaseObject(SessionLocal session, DbObject obj, String newName)`
Rename a database object.
`void`
`renameSchemaObject(SessionLocal session, SchemaObject obj, 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(String cluster)`
`void`
`setCompactMode(int compactMode)`
`void`
`setCompareMode(CompareMode compareMode)`
`void`
`setDefaultNullOrdering(DefaultNullOrdering defaultNullOrdering)`
`void`
`setDefaultTableType(int defaultTableType)`
`void`
`setDeleteFilesOnDisconnect(boolean b)`
`void`
`setEventListener(DatabaseEventListener eventListener)`
`void`
`setEventListenerClass(String className)`
`boolean`
`setExclusiveSession(SessionLocal 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(String serializerName)`
`void`
`setLockMode(int lockMode)`
`void`
`setMasterUser(User user)`
`void`
`setMaxLengthInplaceLob(int value)`
`void`
`setMaxMemoryRows(int value)`
`void`
`setMaxOperationMemory(int maxOperationMemory)`
`void`
`setMode(Mode mode)`
`void`
`setOptimizeReuseResults(boolean b)`
`void`
`setPowerOffCount(int count)`
`void`
`setProgress(int state, String name, long x, long 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`
`setRetentionTime(int value)`
`void`
`setRowFactory(RowFactory rowFactory)`
`void`
`setWriteDelay(int value)`
`void`
`shutdownImmediately()`
Immediately close the database.
`void`
`sync()`
Synchronize the files with the file system.
`String`
`sysIdentifier(String upperName)`
Returns identifier in upper or lower case depending on database settings.
`String`
`toString()`
`void`
`unlockMeta(SessionLocal session)`
Unlock the metadata table.
`boolean`
`unsetExclusiveSession(SessionLocal session)`
Stop exclusive access the database by provided session.
`void`
`updateMeta(SessionLocal session, DbObject obj)`
Update an object in the system table.
`void`
`verifyMetaLocked(SessionLocal session)`
Verify the meta table is locked.
`boolean`
`zeroBasedEnums()`
Returns are ENUM values 0-based.

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

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

## Constructor Details

### Database

public Database(ConnectionInfo ci, String cipher)

## Method Details

### getLockTimeout

public int getLockTimeout()

### getRowFactory

public RowFactory getRowFactory()

### setRowFactory

public void setRowFactory(RowFactory rowFactory)

### setInitialPowerOffCount

public static void setInitialPowerOffCount(int count)

### setPowerOffCount

public void setPowerOffCount(int count)

### getStore

public Store getStore()

### getModificationDataId

public long getModificationDataId()

### getNextModificationDataId

public long getNextModificationDataId()

### getModificationMetaId

public long getModificationMetaId()

### getNextModificationMetaId

public long getNextModificationMetaId()

### getRemoteSettingsId

public long getRemoteSettingsId()

### getNextRemoteSettingsId

public long getNextRemoteSettingsId()

### 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(String name, 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

### populateInfo

public void populateInfo(BiConsumer<String,String> consumer)

### verifyMetaLocked

public void verifyMetaLocked(SessionLocal session)
Verify the meta table is locked.

Parameters:
  `session` - the session

### lockMeta

public boolean lockMeta(SessionLocal 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(SessionLocal session)
Unlock the metadata table.

Parameters:
  `session` - the session

### removeMeta

public void removeMeta(SessionLocal session, int id)
Remove the given object from the metadata.

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

### releaseDatabaseObjectIds

public void releaseDatabaseObjectIds(BitSet idsToRelease)
Mark some database ids as unused.

Parameters:
  `idsToRelease` - the ids to release

### addSchemaObject

public void addSchemaObject(SessionLocal session, SchemaObject obj)
Add a schema object to the database.

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

### addDatabaseObject

public void addDatabaseObject(SessionLocal session, DbObject obj)
Add an object to the database.

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

### 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(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(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(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(String name)
Get the user if it exists, or null if not.

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

### getUser

public User getUser(String name)
Get user with the given name. This method throws an exception if the user does not exist.

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

### findUserOrRole

public RightOwner findUserOrRole(String name)
Get the user or role if it exists, or `null` if not.

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

### removeSession

public void removeSession(SessionLocal 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

### getSystemUser

public User getSystemUser()
Returns system user.

Returns:
  system user

### getMainSchema

public Schema getMainSchema()
Returns main schema (usually PUBLIC).

Returns:
  main schema (usually PUBLIC)

### getAllComments

public ArrayList<Comment> getAllComments()

### getAllowLiterals

public int getAllowLiterals()

### getAllRights

public ArrayList<Right> getAllRights()

### getAllTablesAndViews

public ArrayList<Table> getAllTablesAndViews()
Get all tables and views. Metadata tables may be excluded.

Returns:
  all objects of that type

### getAllSynonyms

public ArrayList<TableSynonym> getAllSynonyms()
Get all synonyms.

Returns:
  all objects of that type

### getAllSchemas

public Collection<Schema> getAllSchemas()

### getAllSchemasNoMeta

public Collection<Schema> getAllSchemasNoMeta()

### getAllSettings

public Collection<Setting> getAllSettings()

### getAllUsersAndRoles

public Collection<RightOwner> getAllUsersAndRoles()

### getCacheType

public String getCacheType()

### getCluster

public 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 String getDatabasePath()
Description copied from interface: `DataHandler`
Get the database path.

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

### getShortName

public String getShortName()

### getName

public String getName()

### getSessions

public SessionLocal[] getSessions(boolean includingSystemSession)
Get all sessions that are currently connected to the database.

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

### updateMeta

public void updateMeta(SessionLocal session, DbObject obj)
Update an object in the system table.

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

### renameSchemaObject

public void renameSchemaObject(SessionLocal session, SchemaObject obj, String newName)
Rename a schema object.

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

### renameDatabaseObject

public void renameDatabaseObject(SessionLocal session, DbObject obj, String newName)
Rename a database object.

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

### getSchema

public Schema getSchema(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(SessionLocal 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(SessionLocal 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 String getTempTableName(String baseName, SessionLocal 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(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()

### getWriteDelay

public int getWriteDelay()

### 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()

### getInDoubtTransactions

public ArrayList<InDoubtTransaction> getInDoubtTransactions()
Get the list of in-doubt transactions.

Returns:
  the list

### setBackgroundException

public void setBackgroundException(DbException e)

### getBackgroundException

public Throwable getBackgroundException()

### flush

public void flush()
Flush all pending changes to the transaction log.

### setEventListener

public void setEventListener(DatabaseEventListener eventListener)

### setEventListenerClass

public void setEventListenerClass(String className)

### setProgress

public void setProgress(int state, String name, long x, long 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 or 0 if unknown

### exceptionThrown

public void exceptionThrown(SQLException e, 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)

### setLockMode

public void setLockMode(int lockMode)

### getLockMode

public int getLockMode()

### setCloseDelay

public void setCloseDelay(int value)

### getSystemSession

public SessionLocal 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 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)

### setAllowLiterals

public void setAllowLiterals(int value)

### getOptimizeReuseResults

public boolean getOptimizeReuseResults()

### setOptimizeReuseResults

public void setOptimizeReuseResults(boolean b)

### getLobSyncObject

public 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

### 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

### setDefaultNullOrdering

public void setDefaultNullOrdering(DefaultNullOrdering defaultNullOrdering)

### getDefaultNullOrdering

public DefaultNullOrdering getDefaultNullOrdering()

### setMaxOperationMemory

public void setMaxOperationMemory(int maxOperationMemory)

### getMaxOperationMemory

public int getMaxOperationMemory()

### getExclusiveSession

public SessionLocal getExclusiveSession()

### isInExclusiveMode

public boolean isInExclusiveMode()

### setExclusiveSession

public boolean setExclusiveSession(SessionLocal 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 or if database is in exclusive mode set by this session already, false otherwise

### unsetExclusiveSession

public boolean unsetExclusiveSession(SessionLocal session)
Stop exclusive access the database by provided session.

Parameters:
  `session` - the session
Returns:
  true if success or if database is in non-exclusive mode already, false otherwise

### getLobFileListCache

public SmallLRUCache<String,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(SessionLocal 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(String driver, String url, String user, 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 username
  `password` - the password
Returns:
  the connection

### toString

public String toString()

Overrides:
  `toString` in class `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

### 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

### getLobSession

public SessionLocal getLobSession()

### getDefaultTableType

public int getDefaultTableType()

### setDefaultTableType

public void setDefaultTableType(int defaultTableType)

### getSettings

public DbSettings getSettings()

### newStringMap

public <V> HashMap<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

### newStringMap

public <V> HashMap<String,V> newStringMap(int initialCapacity)
Create a new hash map. Depending on the configuration, the key is case-sensitive or case-insensitive.

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

### newConcurrentStringMap

public <V> ConcurrentHashMap<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(String a, 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 String sysIdentifier(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

### getPageSize

public int getPageSize()

### getJavaObjectSerializer

public JavaObjectSerializer getJavaObjectSerializer()
Description copied from interface: `CastDataProvider`
Returns the custom Java object serializer, or `null`.

Specified by:
  `getJavaObjectSerializer` in interface `CastDataProvider`
Returns:
  the custom Java object serializer, or `null`

### setJavaObjectSerializerName

public void setJavaObjectSerializerName(String serializerName)

### getTableEngine

public TableEngine getTableEngine(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)

### currentTimeZone

public TimeZoneProvider currentTimeZone()
Description copied from interface: `CastDataProvider`
Returns the current time zone.

Specified by:
  `currentTimeZone` in interface `CastDataProvider`
Returns:
  the current time zone

### zeroBasedEnums

public boolean zeroBasedEnums()
Description copied from interface: `CastDataProvider`
Returns are ENUM values 0-based.

Specified by:
  `zeroBasedEnums` in interface `CastDataProvider`
Returns:
  are ENUM values 0-based