## org.h2.test.db
Class Db

    java.lang.Object
      org.h2.test.db.Db

    public class Db

extends java.lang.Object

A simple wrapper around the JDBC API. Currently used for testing. Features:

- No checked exceptions
- Easy to use, fluent API

Nested Class Summary
`static class` `Db.Prepared` This class represents a prepared statement.

Constructor Summary
`Db(java.sql.Connection conn)` Create a database object using the given connection.

Method Summary
`void` `close()` Close the database connection.
`void` `commit()` Commit a pending transaction.
`void` `execute(java.lang.String sql)` Execute a SQL statement.
`static Db` `open(java.lang.String url, java.lang.String user, java.lang.String password)` Open the database connection.
`Db.Prepared` `prepare(java.lang.String sql)` Prepare a SQL statement.
`java.util.List<java.util.Map<java.lang.String,java.lang.Object>>` `query(java.lang.String sql)` Execute a SQL statement.
`void` `setAutoCommit(boolean autoCommit)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Db

    public Db(java.sql.Connection conn)

  Create a database object using the given connection.

  Parameters:
    `conn` - the database connection

Method Detail

### open

    public static Db open(java.lang.String url,
                          java.lang.String user,
                          java.lang.String password)

  Open the database connection. For most databases, it is not required to load the driver before calling this method.

  Parameters:
    `url` - the database URL
    `user` - the user name
    `password` - the password
  Returns:
    the database

### prepare

    public Db.Prepared prepare(java.lang.String sql)

  Prepare a SQL statement.

  Parameters:
    `sql` - the SQL statement
  Returns:
    the prepared statement

### execute

    public void execute(java.lang.String sql)

  Execute a SQL statement.

  Parameters:
    `sql` - the SQL statement

### query

    public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> query(java.lang.String sql)

  Execute a SQL statement.

  Parameters:
    `sql` - the SQL statement
  Returns:
    a list of maps

### close

    public void close()

  Close the database connection.

### setAutoCommit

    public void setAutoCommit(boolean autoCommit)

### commit

    public void commit()

  Commit a pending transaction.