New ant step - test_database ---------------------------- Key: DS-446 URL: http://jira.dspace.org/jira/browse/DS-446 Project: DSpace 1.x Issue Type: Improvement Affects Versions: 1.5.2, 1.5.1, 1.5.0 Reporter: Stuart Lewis Priority: Minor Attachments: check-db-ant.patch
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:... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.dspace.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Dspace-devel mailing list Dspace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-devel