Class JdbcActions

java.lang.Object
org.europa.together.application.JdbcActions
All Implemented Interfaces:
DatabaseActions

@Repository public class JdbcActions extends Object implements DatabaseActions
Implementation of Database JDBC Actions.
  • Constructor Details

    • JdbcActions

      public JdbcActions()
      Constructor.
  • Method Details

    • connect

      public boolean connect(String propertyFile)
      Description copied from interface: DatabaseActions
      Establish an JDBC connection. If the propertyFile parameter is empty, then the method load by default the configuration from the classpath. The path to the external property file have to be relative to the execution path.
      Specified by:
      connect in interface DatabaseActions
      Parameters:
      propertyFile - as String
      Returns:
      true on success
    • executeSqlFromClasspath

      public boolean executeSqlFromClasspath(String sqlFile)
      Description copied from interface: DatabaseActions
      Load an SQL file from the classpath and execute the script. Attention: This function should be used to populate a database and so on. It is not designed to handle multiple ResultSets by using SELECT. If multiple SELECT statements appears in an SQL file, then only the ResultSet of the last SELECT statement will be available.
      Internal call this function for each single SQL statement the executeQuery() method.
      Specified by:
      executeSqlFromClasspath in interface DatabaseActions
      Parameters:
      sqlFile - as String
      Returns:
      true on success
    • executeQuery

      public ResultSet executeQuery(String sql) throws SQLException
      Description copied from interface: DatabaseActions
      Execute a plain SQL query and get the ResultSet. If there exist multiple SELECT statements, then the ResultSet contains only the rusultSet of the last SELECT statement.
      Specified by:
      executeQuery in interface DatabaseActions
      Parameters:
      sql - as String
      Returns:
      result as ResultSet
      Throws:
      SQLException
    • countResultSets

      public int countResultSets(ResultSet results) throws SQLException
      Description copied from interface: DatabaseActions
      Count the size of a ResultSet.
      Specified by:
      countResultSets in interface DatabaseActions
      Parameters:
      results - as ResultSet
      Returns:
      count the results
      Throws:
      SQLException
    • getJdbcMetaData

      public JdbcConnection getJdbcMetaData() throws SQLException
      Description copied from interface: DatabaseActions
      Return a object with all JDBC connection meta date.
      Specified by:
      getJdbcMetaData in interface DatabaseActions
      Returns:
      JdbcConnection as Object
      Throws:
      SQLException