Package org.h2.samples

# Class Compact

java.lang.Object
org.h2.samples.Compact

public class Compact extends Object
This sample application shows how to compact the database files. This is done by creating a SQL script, and then re-creating the database using this script.

## Constructor Summary

Constructors
Constructor
Description
`Compact()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`compact(String dir, String dbName, String user, String password)`
Utility method to compact a database.
`static void`
`main(String... args)`
This method is called when executing this sample application from the command line.

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

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

## Constructor Details

### Compact

public Compact()

## Method Details

### main

public static void main(String... args) throws Exception
This method is called when executing this sample application from the command line.

Parameters:
  `args` - the command line parameters
Throws:
  `Exception` - on failure

### compact

public static void compact(String dir, String dbName, String user, String password) throws SQLException
Utility method to compact a database.

Parameters:
  `dir` - the directory
  `dbName` - the database name
  `user` - the user name
  `password` - the password
Throws:
  `SQLException` - on failure