Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-446

New ant step - test_database

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.0, 1.5.1, 1.5.2
    • Fix Version/s: 1.6.0
    • Component/s: None
    • Labels:
      None
    • Attachments:
      1
    • Comments:
      3
    • Documentation Status:
      Complete or Committed

      Description

      This patch adds a new ant target 'test_database'. It adds a main() method to DatabaseManager.java which tests a connection to the database and prints out any error messages.

      Ant's build.xml is updated to run this target as the first dependency of fresh_install, so that if the database connection defined in dspace.cfg is not good nothing else will happen (e.g. dspace.home and its directories will not be created) and an error message will appear. There is no point in performing any subsequent step if the DB isn't configured correctly.

      E.g.:

      ant fresh_install
      Buildfile: build.xml

      test_database:
      [java] 2010-01-03 20:55:31,724 INFO org.dspace.core.ConfigurationManager @ Loading system provided config property (-Ddspace.configuration): config/dspace.cfg
      [java] 2010-01-03 20:55:31,729 INFO org.dspace.core.ConfigurationManager @ Using default log4j provided log configuration,if uninitended, check your dspace.cfg for (log.init.config)
      [java]
      [java] Attempting to connect to database:
      [java] - URL: jdbc:postgresql://localhost:54321/dspace
      [java] - Driver: org.postgresql.Driver
      [java] - Username: dspace
      [java] - Password: dspace
      [java] - Schema: null
      [java]
      [java] Testing connection...
      [java]
      [java] Error:
      [java] - org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
      [java]
      [java] Please see the DSpace documentation for assistance.
      [java]

      BUILD FAILED
      /Users/stuartlewis/IntelliJ-Projects/16/dspace/target/dspace-1.6.0-SNAPSHOT-build.dir/build.xml:599: Java returned: 1

      Or on a successful build...

      ant fresh_install
      Buildfile: build.xml

      test_database:
      [java] 2010-01-03 20:56:35,677 INFO org.dspace.core.ConfigurationManager @ Loading system provided config property (-Ddspace.configuration): config/dspace.cfg
      [java] 2010-01-03 20:56:35,682 INFO org.dspace.core.ConfigurationManager @ Using default log4j provided log configuration,if uninitended, check your dspace.cfg for (log.init.config)
      [java]
      [java] Attempting to connect to database:
      [java] - URL: jdbc:postgresql://localhost:5432/dspace
      [java] - Driver: org.postgresql.Driver
      [java] - Username: dspace
      [java] - Password: dspace
      [java] - Schema: null
      [java]
      [java] Testing connection...
      [java] Connected succesfully!
      [java]

      init_installation:...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jtrimble Jeffrey Trimble
              Reporter:
              stuartlewis Stuart Lewis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: