# Data Compression in Java

> Please refer to the Data Compression page for a discussion of the advantages of in-memory and persistent database compression.

> ## In-Memory Database Compression

> For Java in-memory database applications the Database.Parameters for managing data compression are `compressionLevel`, `compressionMask` and `expectedCompressionRatio` which have the same effect as the corresponding `mode_mask` parameters for C applications. Please see the C API Data Compression page for details. The mode bit `MCO_DB_INMEMORY_COMPRESSION` is automatically applied to the mode mask if some non default (not -1) `CompressionLevel` is set. So it is not necessary to set this flag to field `Mode` manually.

> ## Persistent Database Compression

> It is not currently possible to enable persistent database compression on Windows systems. Note that eXtremeDB implements LZ compression in two special file system libraries: `mcofu98zip` and `mcofu98ziplog` which are only available on Unix systems like Linux, MacOS and Solaris. To enable persistent database compression in Java on Unix-Linux systems, The `Database.MCO_CFG_DISK_COMPRESSION` must be passed to the constructor of the Java Database class. This action forces the JNI wrapper to load library `mcofu98zip`. Then the `compressionLevel` and `maxDiskDatabaseSize` fields of the Database.Parameters class manage compression.