diff --git a/dspace-api/src/main/java/org/dspace/storage/rdbms/DatabaseManager.java b/dspace-api/src/main/java/org/dspace/storage/rdbms/DatabaseManager.java index a10ab67514..c8c49a19ac 100644 --- a/dspace-api/src/main/java/org/dspace/storage/rdbms/DatabaseManager.java +++ b/dspace-api/src/main/java/org/dspace/storage/rdbms/DatabaseManager.java @@ -1787,6 +1787,39 @@ public class DatabaseManager } } + /** + * Main method used to perform tests on the database + * + * @param args The command line arguments + */ + public static void main(String[] args) + { + // Get something from dspace.cfg to get the log lines out the way + String url = ConfigurationManager.getProperty("db.url"); + + // Try to connect to the database + System.out.println("\nAttempting to connect to database: "); + System.out.println(" - URL: " + url); + System.out.println(" - Driver: " + ConfigurationManager.getProperty("db.driver")); + System.out.println(" - Username: " + ConfigurationManager.getProperty("db.username")); + System.out.println(" - Password: " + ConfigurationManager.getProperty("db.password")); + System.out.println(" - Schema: " + ConfigurationManager.getProperty("db.schema")); + System.out.println("\nTesting connection..."); + try + { + Connection connection = DatabaseManager.getConnection(); + } + catch (SQLException sqle) + { + System.err.println("\nError: "); + System.err.println(" - " + sqle); + System.err.println("\nPlease see the DSpace documentation for assistance.\n"); + System.exit(1); + } + + System.out.println("Connected succesfully!\n"); + } + } /** diff --git a/dspace/CHANGES b/dspace/CHANGES index e6758d9a64..62d9e5178e 100644 --- a/dspace/CHANGES +++ b/dspace/CHANGES @@ -74,6 +74,8 @@ - [DS-389] Misleading label: "Submit to This Collection" - [DS-424] Export metadata button displayed in JSPUI Administration List of withdrawn items - [DS-442] Enable RSS feeds by default + - [DS-445] New Bitstream.findAll() method + - [DS-446] New ant step - test_database (Larry Stone) - [DS-284] alternate odd and even styles correctly on table rows in Item Summary view diff --git a/dspace/config/launcher.xml b/dspace/config/launcher.xml index 52e1dfe94a..f6b02a9b7c 100644 --- a/dspace/config/launcher.xml +++ b/dspace/config/launcher.xml @@ -247,6 +247,14 @@ + + test-database + Test the DSpace database connection is OK + + org.dspace.storage.rdbms.DatabaseManager + + + sub-daily Send daily subscription notices diff --git a/dspace/src/main/config/build.xml b/dspace/src/main/config/build.xml index facca4bfe3..947f253c11 100644 --- a/dspace/src/main/config/build.xml +++ b/dspace/src/main/config/build.xml @@ -590,6 +590,19 @@ Common usage: + + + + + + + + + + + + + @@ -677,7 +690,7 @@ Common usage: - +