Class DatabaseConnection

  • All Implemented Interfaces:
    java.io.Serializable, RevisionHandler

    public class DatabaseConnection
    extends DatabaseUtils
    Connects to a database.
    Version:
    $Revision: 8034 $
    Author:
    Len Trigg (trigg@cs.waikato.ac.nz), Stefan Mutter (mutter@cs.waikato.ac.nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • DatabaseConnection

        public DatabaseConnection()
                           throws java.lang.Exception
        Sets up the database drivers.
        Throws:
        java.lang.Exception - if an error occurs
      • DatabaseConnection

        public DatabaseConnection​(java.io.File propsFile)
                           throws java.lang.Exception
        Reads the properties from the specified file and sets up the database drivers.
        Parameters:
        propsFile - the props file to load, ignored if null or pointing to a directory
        Throws:
        java.lang.Exception - if an error occurs
      • DatabaseConnection

        public DatabaseConnection​(java.util.Properties props)
                           throws java.lang.Exception
        Uses the specified properties to set up the database drivers.
        Parameters:
        props - the properties to use, ignored if null
        Throws:
        java.lang.Exception - if an error occurs
    • Method Detail

      • getProperties

        public java.util.Properties getProperties()
        Returns the underlying properties object.
        Returns:
        the properties object
      • getUpperCase

        public boolean getUpperCase()
        Check if the property checkUpperCaseNames in the DatabaseUtils file is set to true or false.
        Returns:
        true if the property checkUpperCaseNames in the DatabaseUtils file is set to true, false otherwise.
      • getMetaData

        public java.sql.DatabaseMetaData getMetaData()
                                              throws java.lang.Exception
        Gets meta data for the database connection object.
        Returns:
        the meta data.
        Throws:
        java.lang.Exception - if an error occurs
      • getUpdateCount

        public int getUpdateCount()
                           throws java.sql.SQLException
        Dewtermines if the current query retrieves a result set or updates a table
        Returns:
        the update count (-1 if the query retrieves a result set).
        Throws:
        java.sql.SQLException - if an error occurs