Class DerbyConnection


  • public class DerbyConnection
    extends java.lang.Object
    Singleton class that manages the connection to the Derby database Provides methods to get and close database connections
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void close()
      Closes the database connection
      static java.sql.Connection getConnection()
      Gets a connection to the database Creates a new connection if one doesn't exist or if the existing one is closed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getConnection

        public static java.sql.Connection getConnection()
                                                 throws java.sql.SQLException
        Gets a connection to the database Creates a new connection if one doesn't exist or if the existing one is closed
        Returns:
        A Connection object to the database
        Throws:
        java.sql.SQLException - if a database error occurs
      • close

        public static void close()
                          throws java.sql.SQLException
        Closes the database connection
        Throws:
        java.sql.SQLException - if a database error occurs