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 databasestatic void
reset()
Reset the databasestatic void
runSQL(java.lang.String sqlFile)
Run the sql.
-
Field Details
-
DB_HARD_RESET
public static final java.lang.String DB_HARD_RESETThe 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.ExceptionConnect.- Throws:
java.lang.Exception
- the exception
-
disconnect
public static void disconnect()Disconnect. -
runSQL
public static void runSQL(java.lang.String sqlFile) throws java.io.FileNotFoundExceptionRun 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.FileNotFoundExceptionReset the database- Throws:
java.io.FileNotFoundException
- if the hard reset sql script can't be found
-
hardReset
public static void hardReset() throws java.io.FileNotFoundExceptionReset the database- Throws:
java.io.FileNotFoundException
- if the hard reset sql script can't be found
-