org.h2.android

## Class H2OpenHelper

- java.lang.Object
- - org.h2.android.H2OpenHelper

    public abstract class H2OpenHelper
    extends java.lang.Object

This helper class helps creating and managing databases. A subclass typically implements the "on" methods.

### Method Summary

Methods
`void` `close()` Close the connection.
`H2Database` `getReadableDatabase()` Open a read-only connection.
`H2Database` `getWritableDatabase()` Open a read-write connection.
`abstract void` `onCreate(H2Database db)` This method is called when the database did not already exist.
`void` `onOpen(H2Database db)` This method is called after opening the database.
`abstract void` `onUpgrade(H2Database db, int oldVersion, int newVersion)` This method is called when the version stored in the database file does not match the expected value.

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

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

### Method Detail

#### close

    public void close()

Close the connection.

#### getReadableDatabase

    public H2Database getReadableDatabase()

Open a read-only connection.

Returns:
  a new read-only connection

#### getWritableDatabase

    public H2Database getWritableDatabase()

Open a read-write connection.

Returns:
  a new read-write connection

#### onCreate

    public abstract void onCreate(H2Database db)

This method is called when the database did not already exist.

Parameters:
  `db` - the connection

#### onOpen

    public void onOpen(H2Database db)

This method is called after opening the database.

Parameters:
  `db` - the connection

#### onUpgrade

    public abstract void onUpgrade(H2Database db,
                 int oldVersion,
                 int newVersion)

This method is called when the version stored in the database file does not match the expected value.

Parameters:
  `db` - the connection
  `oldVersion` - the current version
  `newVersion` - the expected version