[exo-jcr-commits] exo-jcr SVN: r5031 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Oct 7 09:02:10 EDT 2011
Author: tolusha
Date: 2011-10-07 09:02:09 -0400 (Fri, 07 Oct 2011)
New Revision: 5031
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
Log:
EXOJCR-1579: RDBMS reindexing only if db2 version >= 9.7.2
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-10-07 08:32:26 UTC (rev 5030)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-10-07 13:02:09 UTC (rev 5031)
@@ -23,6 +23,8 @@
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import java.io.File;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import javax.jcr.RepositoryException;
@@ -138,6 +140,54 @@
@Override
public boolean isReindexingSupport()
{
- return true;
+ Connection con = null;
+ try
+ {
+ con = getJdbcConnection();
+ DatabaseMetaData metaData = con.getMetaData();
+ if (metaData.getDatabaseMajorVersion() > 9)
+ {
+ return true;
+ }
+ else if (metaData.getDatabaseMajorVersion() == 9 && metaData.getDatabaseMinorVersion() > 7)
+ {
+ return true;
+ }
+ else if (metaData.getDatabaseMajorVersion() == 9 && metaData.getDatabaseMinorVersion() == 7)
+ {
+ // returned string like 'SQL09074'
+ char maintenanceVersion =
+ metaData.getDatabaseProductVersion().charAt(metaData.getDatabaseProductVersion().length() - 1);
+ if (new Integer(maintenanceVersion) >= 2)
+ {
+ return true;
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ log.error("Error checking product version.", e);
+ }
+ catch (RepositoryException e)
+ {
+ log.error("Error checking product version.", e);
+ }
+ finally
+ {
+ if (con != null)
+ {
+ try
+ {
+ con.close();
+ }
+ catch (SQLException e)
+ {
+ // ignore me
+ }
+ }
+ }
+
+ log.debug("The version of DB2 is prior to 9.7.2, so the old indexing mechanism will be used");
+ return false;
}
}
More information about the exo-jcr-commits
mailing list