Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-05-15 02:31:28 -0400
committerEike Stepper2013-05-15 02:31:28 -0400
commita18f0f77cf1449305352a13be1674d83e9181097 (patch)
tree1ed0e30d9b9971a304c7b6714c20d81f4d6a1716
parentb52dd58c1a00efac4a0d08352b6a8da6fcba4833 (diff)
downloadcdo-a18f0f77cf1449305352a13be1674d83e9181097.tar.gz
cdo-a18f0f77cf1449305352a13be1674d83e9181097.tar.xz
cdo-a18f0f77cf1449305352a13be1674d83e9181097.zip
[405131] [DB] Launching Servers with HSQLDB or Derby back-ends lead to
issue in CDO 4.2 https://bugs.eclipse.org/bugs/show_bug.cgi?id=405131
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java3
-rw-r--r--plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/DerbyAdapter.java19
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java5
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java9
4 files changed, 31 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 789e8d91ae..7ff993f585 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -619,7 +619,8 @@ public class DBStore extends Store implements IDBStore, IMappingConstants, CDOAl
}
String schemaName = repository.getName();
- boolean fixNullableIndexColumns = schemaVersion < FIRST_VERSION_WITH_NULLABLE_CHECKS;
+ boolean fixNullableIndexColumns = schemaVersion != FIRST_START
+ && schemaVersion < FIRST_VERSION_WITH_NULLABLE_CHECKS;
database = DBUtil.openDatabase(dbAdapter, dbConnectionProvider, schemaName, fixNullableIndexColumns);
IDBSchemaTransaction schemaTransaction = database.openSchemaTransaction();
diff --git a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/DerbyAdapter.java b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/DerbyAdapter.java
index 0c9bab2343..3f68f8f76c 100644
--- a/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/DerbyAdapter.java
+++ b/plugins/org.eclipse.net4j.db.derby/src/org/eclipse/net4j/db/derby/DerbyAdapter.java
@@ -15,6 +15,8 @@ import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.spi.db.DBAdapter;
+import java.sql.SQLException;
+
/**
* A {@link IDBAdapter DB adapter} for <a href="http://db.apache.org/derby">Derby</a> databases.
*
@@ -88,4 +90,21 @@ public abstract class DerbyAdapter extends DBAdapter
return super.isValidFirstChar(ch);
}
}
+
+ @Override
+ public boolean isDuplicateKeyException(SQLException ex)
+ {
+ // The statement was aborted because it would have caused a duplicate key value in a unique or primary key
+ // constraint or unique index identified by '<value>' defined on '<value>'
+ String sqlState = ex.getSQLState();
+ return "23505".equals(sqlState);
+ }
+
+ @Override
+ public boolean isTableNotFoundException(SQLException ex)
+ {
+ // Table/View '<objectName>' does not exist
+ String sqlState = ex.getSQLState();
+ return "42X05".equals(sqlState);
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
index 348fdea592..23322a9f34 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
@@ -768,7 +768,10 @@ public final class DBUtil
try
{
connection = connectionProvider.getConnection();
- return runnable.run(connection);
+
+ T result = runnable.run(connection);
+ connection.commit();
+ return result;
}
catch (SQLException ex)
{
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
index 4e257fe2ea..8f17b3a5f8 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBAdapter.java
@@ -980,7 +980,8 @@ public abstract class DBAdapter implements IDBAdapter
*/
public boolean isDuplicateKeyException(SQLException ex)
{
- return "23001".equals(ex.getSQLState());
+ String sqlState = ex.getSQLState();
+ return "23001".equals(sqlState);
}
/**
@@ -988,7 +989,8 @@ public abstract class DBAdapter implements IDBAdapter
*/
public boolean isTableNotFoundException(SQLException ex)
{
- return "42S02".equals(ex.getSQLState());
+ String sqlState = ex.getSQLState();
+ return "42S02".equals(sqlState);
}
/**
@@ -996,7 +998,8 @@ public abstract class DBAdapter implements IDBAdapter
*/
public boolean isColumnNotFoundException(SQLException ex)
{
- return "42S22".equals(ex.getSQLState());
+ String sqlState = ex.getSQLState();
+ return "42S22".equals(sqlState);
}
/**

Back to the top