|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.db.AbstractDatabase
org.jminor.common.db.dbms.H2Database
public final class H2Database
A Database implementation based on the H2 database.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jminor.common.db.Database |
---|
Database.Statistics |
Field Summary | |
---|---|
static String |
DATABASE_IN_MEMORY
Specifies whether or not the database should be run in in-memory mode Values: "true"/"false" Default: "false" |
static String |
DATABASE_INIT_SCRIPT
The script to run when initializing an embedded database |
Fields inherited from interface org.jminor.common.db.Database |
---|
DATABASE_EMBEDDED, DATABASE_HOST, DATABASE_IMPLEMENTATION_CLASS, DATABASE_POOL_STATISTICS, DATABASE_PORT, DATABASE_SID, DATABASE_TYPE, DEFAULT_LOGIN_TIMEOUT, DERBY, H2, HSQL, MYSQL, ORACLE, PASSWORD_PROPERTY, POSTGRESQL, SQLSERVER, USER_PROPERTY |
Constructor Summary | |
---|---|
H2Database()
Instantiates a new H2Database. |
|
H2Database(String databaseName)
Instantiates a new embedded H2Database. |
|
H2Database(String host,
String port,
String databaseName)
Instantiates a new networked H2Database. |
Method Summary | |
---|---|
static void |
createEmbeddedH2Database(String scriptPath,
boolean inMemory)
Initializes a new H2 database, with the given script |
String |
getAutoIncrementValueSQL(String idSource)
Returns a query string for retrieving the last automatically generated id from the given id source |
String |
getSequenceSQL(String sequenceName)
|
String |
getURL(Properties connectionProperties)
|
void |
loadDriver()
Loads the database driver |
H2Database |
setUrlAppend(String urlAppend)
|
Methods inherited from class org.jminor.common.db.AbstractDatabase |
---|
addConnectionProperties, createConnection, getAuthenticationInfo, getCheckConnectionQuery, getDatabaseType, getErrorMessage, getHost, getLoginTimeout, getPort, getSid, isEmbedded, shutdownEmbedded, supportsIsValid, supportsNowait |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DATABASE_IN_MEMORY
public static final String DATABASE_INIT_SCRIPT
Constructor Detail |
---|
public H2Database()
public H2Database(String databaseName)
databaseName
- the path to the database filespublic H2Database(String host, String port, String databaseName)
host
- the host nameport
- the port numberdatabaseName
- the database nameMethod Detail |
---|
public H2Database setUrlAppend(String urlAppend)
urlAppend
- a string to append to the connection URL
public void loadDriver() throws ClassNotFoundException
ClassNotFoundException
- in case the driver class in not foundpublic String getAutoIncrementValueSQL(String idSource)
idSource
- the source for the id, for example a sequence name or in the case of Derby, the name of the table
public String getSequenceSQL(String sequenceName)
getSequenceSQL
in interface Database
getSequenceSQL
in class AbstractDatabase
sequenceName
- the name of the sequence
public String getURL(Properties connectionProperties)
connectionProperties
- the connection properties, used primarily to provide
embedded databases with user info for authentication purposes
public static void createEmbeddedH2Database(String scriptPath, boolean inMemory) throws SQLException
scriptPath
- the path to the initilization scriptinMemory
- true if the database should be created in memory only
SQLException
- in case of an exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |