org.h2.upgrade

## Class DbUpgrade

- java.lang.Object
- - org.h2.upgrade.DbUpgrade

    public class DbUpgrade
    extends java.lang.Object

This class starts the conversion from older database versions to the current version if the respective classes are found.

### Constructor Summary

Constructors
Constructor and Description
`DbUpgrade()`

### Method Summary

Methods
`static java.sql.Connection` `connectOrUpgrade(java.lang.String url, java.util.Properties info)` If the upgrade classes are present, upgrade the database, or connect using the old version (if the parameter NO_UPGRADE is set to true).
`static void` `setDeleteOldDb(boolean deleteOldDb)` Old files will be renamed to .backup after a successful conversion.
`static void` `setScriptInTempDir(boolean scriptInTempDir)` The conversion script file will per default be created in the db directory.

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

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

### Constructor Detail

#### DbUpgrade

    public DbUpgrade()

### Method Detail

#### connectOrUpgrade

    public static java.sql.Connection connectOrUpgrade(java.lang.String url,
                                       java.util.Properties info)
                                                throws java.sql.SQLException

If the upgrade classes are present, upgrade the database, or connect using the old version (if the parameter NO_UPGRADE is set to true). If the database is upgraded, or if no upgrade is possible or needed, this methods returns null.

Parameters:
  `url` - the database URL
  `info` - the properties
Returns:
  the connection if connected with the old version (NO_UPGRADE)
Throws:
  `java.sql.SQLException`

#### setScriptInTempDir

    public static void setScriptInTempDir(boolean scriptInTempDir)

The conversion script file will per default be created in the db directory. Use this method to change the directory to the temp directory.

Parameters:
  `scriptInTempDir` - true if the conversion script should be located in the temp directory.

#### setDeleteOldDb

    public static void setDeleteOldDb(boolean deleteOldDb)

Old files will be renamed to .backup after a successful conversion. To delete them after the conversion, use this method with the parameter 'true'.

Parameters:
  `deleteOldDb` - if true, the old db files will be deleted.