Package org.h2.jmx

# Class DatabaseInfo

java.lang.Object
org.h2.jmx.DatabaseInfo

All Implemented Interfaces:
  `DatabaseInfoMBean`

public class DatabaseInfo extends Object implements DatabaseInfoMBean
The MBean implementation.

## Method Summary

Modifier and Type
Method
Description
`int`
`getCacheSize()`
The current cache size in KB.
`int`
`getCacheSizeMax()`
The maximum cache size in KB.
`long`
`getFileReadCount()`
The file read count since the database was opened.
`long`
`getFileSize()`
The database file size in KB.
`long`
`getFileWriteCount()`
The number of write operations since the database was opened.
`String`
`getMode()`
The database compatibility mode (REGULAR if no compatibility mode is used).
`int`
`getTraceLevel()`
The trace level (0 disabled, 1 error, 2 info, 3 debug).
`String`
`getVersion()`
The database version.
`boolean`
`isExclusive()`
Is the database open in exclusive mode?
`boolean`
`isReadOnly()`
Is the database read-only?
`String`
`listSessions()`
List sessions, including the queries that are in progress, and locked tables.
`String`
`listSettings()`
List the database settings.
`static void`
`registerMBean(ConnectionInfo connectionInfo, Database database)`
Registers an MBean for the database.
`void`
`setCacheSizeMax(int kb)`
Change the maximum size.
`void`
`setTraceLevel(int level)`
Set the trace level.
`static void`
`unregisterMBean(String name)`
Unregisters the MBean for the database if one is registered.

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

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

## Method Details

### registerMBean

public static void registerMBean(ConnectionInfo connectionInfo, Database database) throws JMException
Registers an MBean for the database.

Parameters:
  `connectionInfo` - connection info
  `database` - database
Throws:
  `JMException` - on failure

### unregisterMBean

public static void unregisterMBean(String name) throws Exception
Unregisters the MBean for the database if one is registered.

Parameters:
  `name` - database name
Throws:
  `JMException` - on failure
  `Exception`

### isExclusive

public boolean isExclusive()
Description copied from interface: `DatabaseInfoMBean`
Is the database open in exclusive mode?

Specified by:
  `isExclusive` in interface `DatabaseInfoMBean`
Returns:
  true if the database is open in exclusive mode, false otherwise

### isReadOnly

public boolean isReadOnly()
Description copied from interface: `DatabaseInfoMBean`
Is the database read-only?

Specified by:
  `isReadOnly` in interface `DatabaseInfoMBean`
Returns:
  true if the database is read-only, false otherwise

### getMode

public String getMode()
Description copied from interface: `DatabaseInfoMBean`
The database compatibility mode (REGULAR if no compatibility mode is used).

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

### getTraceLevel

public int getTraceLevel()
Description copied from interface: `DatabaseInfoMBean`
The trace level (0 disabled, 1 error, 2 info, 3 debug).

Specified by:
  `getTraceLevel` in interface `DatabaseInfoMBean`
Returns:
  the level

### setTraceLevel

public void setTraceLevel(int level)
Description copied from interface: `DatabaseInfoMBean`
Set the trace level.

Specified by:
  `setTraceLevel` in interface `DatabaseInfoMBean`
Parameters:
  `level` - the new value

### getFileWriteCount

public long getFileWriteCount()
Description copied from interface: `DatabaseInfoMBean`
The number of write operations since the database was opened.

Specified by:
  `getFileWriteCount` in interface `DatabaseInfoMBean`
Returns:
  the write count

### getFileReadCount

public long getFileReadCount()
Description copied from interface: `DatabaseInfoMBean`
The file read count since the database was opened.

Specified by:
  `getFileReadCount` in interface `DatabaseInfoMBean`
Returns:
  the read count

### getFileSize

public long getFileSize()
Description copied from interface: `DatabaseInfoMBean`
The database file size in KB.

Specified by:
  `getFileSize` in interface `DatabaseInfoMBean`
Returns:
  the number of pages

### getCacheSizeMax

public int getCacheSizeMax()
Description copied from interface: `DatabaseInfoMBean`
The maximum cache size in KB.

Specified by:
  `getCacheSizeMax` in interface `DatabaseInfoMBean`
Returns:
  the maximum size

### setCacheSizeMax

public void setCacheSizeMax(int kb)
Description copied from interface: `DatabaseInfoMBean`
Change the maximum size.

Specified by:
  `setCacheSizeMax` in interface `DatabaseInfoMBean`
Parameters:
  `kb` - the cache size in KB.

### getCacheSize

public int getCacheSize()
Description copied from interface: `DatabaseInfoMBean`
The current cache size in KB.

Specified by:
  `getCacheSize` in interface `DatabaseInfoMBean`
Returns:
  the current size

### getVersion

public String getVersion()
Description copied from interface: `DatabaseInfoMBean`
The database version.

Specified by:
  `getVersion` in interface `DatabaseInfoMBean`
Returns:
  the version

### listSettings

public String listSettings()
Description copied from interface: `DatabaseInfoMBean`
List the database settings.

Specified by:
  `listSettings` in interface `DatabaseInfoMBean`
Returns:
  the database settings

### listSessions

public String listSessions()
Description copied from interface: `DatabaseInfoMBean`
List sessions, including the queries that are in progress, and locked tables.

Specified by:
  `listSessions` in interface `DatabaseInfoMBean`
Returns:
  information about the sessions