Package tenapull.util

Class Database

java.lang.Object
tenapull.util.Database

public class Database
extends java.lang.Object
Provides access to the database Created on 8/31/16.

3/10/22 WJA -- changed from singleton class to static (no instance) utility class

  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DB_HARD_RESET
    The name of the sql script which performs a full reset of the database
  • Method Summary

    Modifier and Type Method Description
    static void connect()
    Connect.
    static void disconnect()
    Disconnect.
    static java.sql.Connection getConnection()
    Gets connection.
    static void hardReset()
    Reset the database
    static void reset()
    Reset the database
    static void runSQL​(java.lang.String sqlFile)
    Run the sql.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DB_HARD_RESET

      public static final java.lang.String DB_HARD_RESET
      The name of the sql script which performs a full reset of the database
      See Also:
      Constant Field Values
  • Method Details

    • getConnection

      public static java.sql.Connection getConnection()
      Gets connection.
      Returns:
      the connection
    • connect

      public static void connect() throws java.lang.Exception
      Connect.
      Throws:
      java.lang.Exception - the exception
    • disconnect

      public static void disconnect()
      Disconnect.
    • runSQL

      public static void runSQL​(java.lang.String sqlFile) throws java.io.FileNotFoundException
      Run the sql.
      Parameters:
      sqlFile - the sql file to be read and executed line by line
      Throws:
      java.io.FileNotFoundException - the file not found exception
    • reset

      public static void reset() throws java.io.FileNotFoundException
      Reset the database
      Throws:
      java.io.FileNotFoundException - if the hard reset sql script can't be found
    • hardReset

      public static void hardReset() throws java.io.FileNotFoundException
      Reset the database
      Throws:
      java.io.FileNotFoundException - if the hard reset sql script can't be found