corrected db initialization sequence

Former-commit-id: bfea90ba44673f49b76d509688a6e4a4d6a912a0
This commit is contained in:
Jeremy Long
2014-03-01 15:26:17 -05:00
parent 0bec242b2e
commit a85fb3a871

View File

@@ -85,7 +85,8 @@ public final class ConnectionFactory {
if (connectionString != null) { if (connectionString != null) {
return; return;
} }
Connection conn = null;
try {
//load the driver if necessary //load the driver if necessary
final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, ""); final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, "");
if (!driverName.isEmpty()) { //likely need to load the correct driver if (!driverName.isEmpty()) { //likely need to load the correct driver
@@ -127,7 +128,6 @@ public final class ConnectionFactory {
Logger.getLogger(CveDB.class.getName()).log(Level.FINE, "Connection String: {0}", connectionString); Logger.getLogger(CveDB.class.getName()).log(Level.FINE, "Connection String: {0}", connectionString);
Logger.getLogger(CveDB.class.getName()).log(Level.FINE, "Database User: {0}", userName); Logger.getLogger(CveDB.class.getName()).log(Level.FINE, "Database User: {0}", userName);
Connection conn = null;
try { try {
conn = DriverManager.getConnection(connectionString, userName, password); conn = DriverManager.getConnection(connectionString, userName, password);
} catch (SQLException ex) { } catch (SQLException ex) {
@@ -146,6 +146,7 @@ public final class ConnectionFactory {
Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, "Unable to connect to the database", ex); Logger.getLogger(ConnectionFactory.class.getName()).log(Level.FINE, "Unable to connect to the database", ex);
throw new DatabaseException("Unable to connect to the database"); throw new DatabaseException("Unable to connect to the database");
} }
}
if (shouldCreateSchema) { if (shouldCreateSchema) {
try { try {