[FELIX-1519]Karaf Failover does not work with PostgreSQL and Oracle
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@807462 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/main/src/main/java/org/apache/felix/karaf/main/DefaultJDBCLock.java b/karaf/main/src/main/java/org/apache/felix/karaf/main/DefaultJDBCLock.java
index 551b59b..88fd5bd 100644
--- a/karaf/main/src/main/java/org/apache/felix/karaf/main/DefaultJDBCLock.java
+++ b/karaf/main/src/main/java/org/apache/felix/karaf/main/DefaultJDBCLock.java
@@ -147,6 +147,7 @@
if (lockConnection != null && !lockConnection.isClosed()) {
lockConnection.rollback();
lockConnection.close();
+ lockConnection = null;
}
}
@@ -197,7 +198,11 @@
Connection conn = null;
try {
Class.forName(driver);
- conn = DriverManager.getConnection(url + ";create=true", username, password);
+ if (url.startsWith("jdbc:derby:")) {
+ conn = DriverManager.getConnection(url + ";create=true", username, password);
+ } else {
+ conn = DriverManager.getConnection(url, username, password);
+ }
} catch (Exception e) {
System.err.println("Error occured while setting up JDBC connection: " + e);
throw e;