com.melloware.jukes.db
Class Database

java.lang.Object
  extended by com.melloware.jukes.db.Database

public final class Database
extends java.lang.Object

Static class used to start and stop the HSQLDB Server which will be run in process in the same JVM but can be connected to externally by other applications.

Copyright (c) 1999-2007 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III
See Also:
Server

Method Summary
static void backupDatabase(java.sql.Connection aConnection, java.lang.String aZipLocation)
          Back up this database to a zipped file at location aLocation.
static void executeSQL(java.sql.Connection connection, java.lang.String sql)
          Executes a SQL string against the connection.
static java.lang.String getJdbcURL()
          Gets the connection URL for this database.
static void setWriteDelay(java.sql.Connection connection, java.lang.String writeDelay)
          But HSQLDB has a hidden catch; the write delay.
static void shutdown()
          Shuts the database down.
static void startup(java.lang.String location, java.lang.String alias)
          Starts the database up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJdbcURL

public static java.lang.String getJdbcURL()
Gets the connection URL for this database.

Returns:
the string connection URL for JDBC drivers

setWriteDelay

public static void setWriteDelay(java.sql.Connection connection,
                                 java.lang.String writeDelay)
But HSQLDB has a hidden catch; the write delay. By default, HSQLDB has a write delay for all activity of 60 seconds. I'd forgotten this myself when developing the example for this article and was running short lived tests and was surprised to find empty databases on disk. You can of course turn off the write delay feature completely, or tune it to something more appropriate to your application's life cycle.

Parameters:
connection - the JDBC connection to use
writeDelay - the write delay either TRUE, FALSE, or a number in seconds

backupDatabase

public static void backupDatabase(java.sql.Connection aConnection,
                                  java.lang.String aZipLocation)
Back up this database to a zipped file at location aLocation.

Parameters:
aConnection - the connection to use
aZipLocation - the location to back up to

executeSQL

public static void executeSQL(java.sql.Connection connection,
                              java.lang.String sql)
Executes a SQL string against the connection.

Parameters:
connection - the connection to use
sql - the sql string to execute

shutdown

public static void shutdown()
Shuts the database down.


startup

public static void startup(java.lang.String location,
                           java.lang.String alias)
Starts the database up.



Copyright © 1999-2008 Melloware Inc. All Rights Reserved.