Top Description Fields Constructors Methods
org.h2.tools

public final Class Upgrade

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, java.net.URL, java.nio.file.Files, .Path, .Paths, .StandardCopyOption, java.security.MessageDigest, .NoSuchAlgorithmException, java.sql.Connection, java.util.ArrayList, .HashMap, .Properties, .UUID, java.util.zip.ZipEntry, .ZipInputStream, org.h2.engine.ConnectionInfo, .Constants, org.h2.jdbc.JdbcConnection, org.h2.util.IOUtils, .StringUtils

Upgrade utility.

Field Summary

Modifier and TypeField and Description
private static final String[]
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static byte[]
check(byte[] data, String sha256Checksum, String checksummedFile)

private static String
private static byte[]
download(String fileURL, String sha256Checksum)

private static byte[]
downloadUsingMaven(String group, String artifact, String version, String sha256Checksum)

private static int
private static String
getSHA256(byte[] data)

public static Driver

Returns:

the driver of the specified version
loadH2
(int
the version to load
version
)

Loads the specified version of H2 in a separate class loader.

private static void
rename(String name, boolean back)

private static void
rename(String name, String suffix, boolean back)

public static void
unloadH2(Driver
the driver to unload
driver
)

Unloads the specified driver of H2.

public static boolean

Returns:

true on success, false if URL is a remote or in-memory URL
upgrade
(String
the JDBC connection URL
url
,
Properties
the connection properties ("user", "password", etc).
info
,
int
the old version of H2
version
)

Performs database upgrade from an older version of H2.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHECKSUMSback to summary
private static final String[] CHECKSUMS
REPOSITORYback to summary
private static final String REPOSITORY

Constructor Detail

Upgradeback to summary
private Upgrade()

Method Detail

checkback to summary
private static byte[] check(byte[] data, String sha256Checksum, String checksummedFile)
copyPropertyback to summary
private static String copyProperty(ConnectionInfo ci, StringBuilder oldUrl, String name)
downloadback to summary
private static byte[] download(String fileURL, String sha256Checksum)
downloadUsingMavenback to summary
private static byte[] downloadUsingMaven(String group, String artifact, String version, String sha256Checksum) throws IOException
execback to summary
private static int exec(ArrayList<String> args)
getSHA256back to summary
private static String getSHA256(byte[] data)
loadH2back to summary
public static Driver loadH2(int version) throws IOException, ReflectiveOperationException

Loads the specified version of H2 in a separate class loader.

Parameters
version:int

the version to load

Returns:Driver

the driver of the specified version

Exceptions
IOException:
on I/O exception
ReflectiveOperationException:
on exception during initialization of the driver
renameback to summary
private static void rename(String name, boolean back) throws IOException
renameback to summary
private static void rename(String name, String suffix, boolean back) throws IOException
unloadH2back to summary
public static void unloadH2(Driver driver) throws ReflectiveOperationException

Unloads the specified driver of H2.

Parameters
driver:Driver

the driver to unload

Exceptions
ReflectiveOperationException:
on exception
upgradeback to summary
public static boolean upgrade(String url, Properties info, int version) throws Exception

Performs database upgrade from an older version of H2.

Parameters
url:String

the JDBC connection URL

info:Properties

the connection properties ("user", "password", etc).

version:int

the old version of H2

Returns:boolean

true on success, false if URL is a remote or in-memory URL

Exceptions
Exception:
on failure