
public final class H2Database extends Object implements DatabaseImpl
| Modifier and Type | Field and Description |
|---|---|
private Connection |
connection |
private org.h2.jdbcx.JdbcConnectionPool |
connectionPool |
| Constructor and Description |
|---|
H2Database(String dbName)
Create a new H2 database instance for a given database name.
|
H2Database(String dbName,
boolean deleteDb)
Create a new H2 database instance for a given database name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the database connection.
|
Connection |
getConnection()
Get a connection to the database.
|
org.jooq.SQLDialect |
getDialect()
Obtain the database dialect e.g.
|
void |
open(String database)
Open the database for connection.
|
private Connection connection
private org.h2.jdbcx.JdbcConnectionPool connectionPool
public H2Database(String dbName)
dbName - the name of the database to which we will connect.public H2Database(String dbName, boolean deleteDb)
dbName - the name of the database to which we will connect.deleteDb - delete the contents of the database once a connection is made.public void open(String database)
DatabaseImplopen in interface DatabaseImpldatabase - the name of the database to open/connect.public void close()
DatabaseImplclose in interface DatabaseImplclose in interface AutoCloseablepublic Connection getConnection() throws SQLException
DatabaseImplgetConnection in interface DatabaseImplSQLException - if the connection cannot be obtained.public org.jooq.SQLDialect getDialect()
DatabaseImplgetDialect in interface DatabaseImplCopyright © 2015 University of Glasgow. All rights reserved.