From: <mwl...@us...> - 2009-01-26 18:51:55
|
Revision: 857 http://cishell.svn.sourceforge.net/cishell/?rev=857&view=rev Author: mwlinnem Date: 2009-01-26 18:51:50 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Made a few changes based on Patrick's review. Modified Paths: -------------- trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java Modified: trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java =================================================================== --- trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java 2009-01-26 18:31:07 UTC (rev 856) +++ trunk/core/org.cishell.reference.service.database/src/org/cishell/reference/service/database/DerbyDatabaseService.java 2009-01-26 18:51:50 UTC (rev 857) @@ -40,6 +40,7 @@ "org.apache.derby.jdbc.EmbeddedDriver"; private static final String DERBY_PROTOCOL = "jdbc:derby:"; private static final String DEFAULT_CREATE_CONNECTION_STRING = ";create=true"; + private static final String DEFAULT_SHUTDOWN_CONNECTION_STRING =";shutdown=true"; private static final String DEFAULT_DB_NAME = "cishell_database"; //where the database exists on the filesystem (relative to the application root directory) @@ -80,7 +81,9 @@ //try to clean out the database and shut it down. try { removeAllNonSystemDatabaseTables(); - DriverManager.getConnection("jdbc:derby:;shutdown=true"); + String shutdownDatabaseCommand = + DERBY_PROTOCOL + DEFAULT_SHUTDOWN_CONNECTION_STRING; + DriverManager.getConnection(shutdownDatabaseCommand); } catch (Exception e) { String message = "An unexpected exception occurred while shutting down the internal database." + @@ -122,6 +125,7 @@ removeTables.executeBatch(); } + //TODO: It could be that we should give everyone different datasources instead of the same one private PoolingDataSource getDataSource() throws DatabaseCreationException { @@ -129,7 +133,8 @@ return poolingDataSource; } - //lazy-load the pooling data source + //lazy-load the pooling data source (implicitly creates the initial database connection) + //TODO: Make it more clear where database connection is initially established private void initializePoolingDataSource() throws DatabaseCreationException { if (this.poolingDataSource != null) { return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |