diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/DataSetDeletionMaintenanceTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/DataSetDeletionMaintenanceTask.java
index 7905191229e9c643ad33f61ea2991b002de0a4ec..7655ae41b9a8ba047cb27b96cca286f413db4372 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/DataSetDeletionMaintenanceTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/plugins/DataSetDeletionMaintenanceTask.java
@@ -31,8 +31,6 @@ import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.common.logging.LogInitializer;
-import ch.systemsx.cisd.common.utilities.PropertyUtils;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.etlserver.IMaintenanceTask;
 import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
 import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
@@ -47,20 +45,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DeletedDataSet;
 public class DataSetDeletionMaintenanceTask implements IMaintenanceTask
 {
 
-    private static final String DATABASE_READ_WRITE_GROUP = "database.read-write-group";
-
-    private static final String DATABASE_READ_ONLY_GROUP = "database.read-only-group";
-
-    private static final String DATABASE_SCRIPT_FOLDER_KEY = "database.script-folder";
-
-    private static final String DATABASE_KIND = "database.kind";
-
-    private static final String BASIC_DATABASE_NAME_KEY = "database.basic-database-name";
-
-    private static final String DATABASE_ENGINE_KEY = "database.engine";
-
-    private static final String DEFAULT_DATABASE_ENGINE = "postgresql";
-
     private static final String DEFAULT_DATA_SET_PERM_ID = "PERM_ID";
 
     private static final String DATA_SET_PERM_ID_KEY = "data-set-perm-id";
@@ -107,52 +91,11 @@ public class DataSetDeletionMaintenanceTask implements IMaintenanceTask
         dataSetTableName =
                 properties.getProperty(DATA_SET_TABLE_NAME_KEY, DEFAULT_DATA_SET_TABLE_NAME);
         permIDColumn = properties.getProperty(DATA_SET_PERM_ID_KEY, DEFAULT_DATA_SET_PERM_ID);
-        DatabaseConfigurationContext context = createDatabaseConfigurationContext(properties);
-        init(context);
-        this.dataSource = context.getDataSource();
+        this.dataSource = ServiceProvider.getDataSourceProvider().getDataSource(properties);
         checkDatabseConnection();
         operationLog.info("Plugin initialized: " + pluginName);
     }
 
-    /**
-     * Creates a database configuration context from the specified properties.
-     */
-    protected DatabaseConfigurationContext createDatabaseConfigurationContext(Properties properties)
-    {
-        DatabaseConfigurationContext configurationContext = new DatabaseConfigurationContext();
-        configurationContext.setDatabaseEngineCode(properties.getProperty(DATABASE_ENGINE_KEY,
-                DEFAULT_DATABASE_ENGINE));
-        configurationContext.setBasicDatabaseName(PropertyUtils.getMandatoryProperty(properties,
-                BASIC_DATABASE_NAME_KEY));
-        configurationContext.setDatabaseKind(PropertyUtils.getMandatoryProperty(properties,
-                DATABASE_KIND));
-        String scriptFolder = properties.getProperty(DATABASE_SCRIPT_FOLDER_KEY);
-        if (scriptFolder != null)
-        {
-            configurationContext.setScriptFolder(scriptFolder + "/sql");
-        }
-        String readOnlyGroup = properties.getProperty(DATABASE_READ_ONLY_GROUP);
-        if (readOnlyGroup != null)
-        {
-            configurationContext.setReadOnlyGroup(readOnlyGroup);
-        }
-        String readWriteGroup = properties.getProperty(DATABASE_READ_WRITE_GROUP);
-        if (readWriteGroup != null)
-        {
-            configurationContext.setReadWriteGroup(readWriteGroup);
-        }
-        return configurationContext;
-    }
-
-    /**
-     * Initializes the data base if necessary. This method should be overridden if needed because
-     * this implementation does nothing.
-     */
-    protected void init(DatabaseConfigurationContext databaseConfigurationContext)
-    {
-
-    }
-
     private void checkDatabseConnection()
     {
         Connection connection = null;
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataSourceManager.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataSourceManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..104d3e59be54bdd2efb9208cb5ae09d78127985b
--- /dev/null
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataSourceManager.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.dss.generic.server;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import org.apache.log4j.Logger;
+
+import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
+import ch.systemsx.cisd.common.logging.LogCategory;
+import ch.systemsx.cisd.common.logging.LogFactory;
+import ch.systemsx.cisd.common.utilities.ClassUtils;
+import ch.systemsx.cisd.common.utilities.PropertyUtils;
+import ch.systemsx.cisd.openbis.dss.generic.shared.utils.PropertyParametersUtil;
+import ch.systemsx.cisd.openbis.dss.generic.shared.utils.PropertyParametersUtil.SectionProperties;
+
+/**
+ * Stores and provides access to data sources defined in properties file.
+ *<p>
+ * Properties file example: <blockquote>
+ * 
+ * <pre>
+ * # Define names of data sources
+ * data-sources = my-data-source-1, my-data-source-2 
+ * 
+ * # Configure data source my-data-source-1
+ * my-data-source-1.version-holder-class = ch.example.databases.MyDatabase1VersionHolder
+ * my-data-source-1.databaseEngineCode = postgresql
+ * my-data-source-1.basicDatabaseName = my-database-1
+ * my-data-source-1.databaseKind = dev
+ * my-data-source-1.scriptFolder = sql
+ * 
+ * # Configure data source my-data-source-2
+ * my-data-source-2.version-holder-class = ch.example.databases.MyDatabase2VersionHolder
+ * my-data-source-2.factory-class = ch.example.databases.MyDataSourceFactory
+ * my-data-source-2.exampleParameter1 = my-database-2
+ * my-data-source-2.exampleParameter2 = 22
+ * 
+ * # Use my-data-source-1 as data source for archiver
+ * archiver.class = ch.example.archivers.MyArchiver
+ * archiver.data-source = my-data-source-1
+ * 
+ * </pre>
+ * 
+ * </blockquote>
+ * <p>
+ * 
+ * @author Izabela Adamczyk
+ */
+public class DataSourceManager
+{
+    static final String DATA_SOURCES_KEY = "data-sources";
+
+    private static final String DATA_SOURCE_FACTORY_CLASS_KEY = "factory-class";
+
+    private static final Logger operationLog =
+            LogFactory.getLogger(LogCategory.OPERATION, DataSourceManager.class);
+
+    private final Map<String, DataSource> dataSources;
+
+    public static final String DATA_SOURCE_KEY = "data-source";
+
+    private DataSourceManager()
+    {
+        Properties properties = PropertyParametersUtil.loadServiceProperties();
+        dataSources = new HashMap<String, DataSource>();
+        SectionProperties[] props =
+                PropertyParametersUtil
+                        .extractSectionProperties(properties, DATA_SOURCES_KEY, false);
+        for (SectionProperties sectionProperties : props)
+        {
+            Properties dataSourceProperties = sectionProperties.getProperties();
+            String dataSourceName = sectionProperties.getKey();
+            String dataSourceFactoryClass =
+                    sectionProperties.getProperties().getProperty(DATA_SOURCE_FACTORY_CLASS_KEY,
+                            DefaultDataSourceFactory.class.getName());
+            try
+            {
+                IDataSourceFactory factory =
+                        ClassUtils.create(IDataSourceFactory.class, dataSourceFactoryClass);
+                DataSource dataSource = factory.create(dataSourceProperties);
+                dataSources.put(dataSourceName, dataSource);
+                if (operationLog.isInfoEnabled())
+                {
+                    operationLog.info("Data source '" + dataSourceName + "' defined.");
+                }
+            } catch (Exception ex)
+            {
+                throw new ConfigurationFailureException(
+                        "Error occured while creating data source '" + dataSourceName + "': "
+                                + ex.getMessage(), ex);
+            }
+        }
+        if (operationLog.isInfoEnabled())
+        {
+            operationLog.info("Data source provider initialized with " + dataSources.size()
+                    + " data sources.");
+        }
+    }
+
+    /**
+     * Returns data source configured with given name or throws {@link IllegalArgumentException} if
+     * not configured.
+     */
+    public DataSource getDataSource(String name) throws IllegalArgumentException
+    {
+        DataSource result = dataSources.get(name);
+        if (result == null)
+        {
+            String message = "Data source '" + name + "' has not been configured.";
+            throw new IllegalArgumentException(message);
+        } else
+        {
+            return result;
+        }
+    }
+
+    /**
+     * Extracts data source name ({@link #DATA_SOURCE_KEY}) from properties and returns requested
+     * data source. See also {@link #getDataSource(String)}.
+     */
+    public DataSource getDataSource(Properties properties)
+    {
+        return getDataSource(extractDataSourceName(properties));
+    }
+
+    /**
+     * Extracts data source name ({@link #DATA_SOURCE_KEY}) from properties.
+     */
+    public static final String extractDataSourceName(Properties properties)
+    {
+        return PropertyUtils.getMandatoryProperty(properties, DATA_SOURCE_KEY);
+    }
+
+}
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DefaultDataSourceFactory.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DefaultDataSourceFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..0b239b380ce229331f9abb26807a7717f91dcba4
--- /dev/null
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DefaultDataSourceFactory.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.dss.generic.server;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
+import ch.systemsx.cisd.common.utilities.BeanUtils;
+import ch.systemsx.cisd.common.utilities.ClassUtils;
+import ch.systemsx.cisd.dbmigration.DBMigrationEngine;
+import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
+
+/**
+ * Creates a {@link DataSource} using {@link DatabaseConfigurationContext} and given properties. The
+ * database is migrated to the version specified by {@link #VERSION_HOLDER_CLASS_KEY} property.
+ * 
+ * @author Izabela Adamczyk
+ */
+public class DefaultDataSourceFactory implements IDataSourceFactory
+{
+
+    static final String VERSION_HOLDER_CLASS_KEY = "version-holder-class";
+
+    public DataSource create(Properties dbProps)
+    {
+        DatabaseConfigurationContext context =
+                BeanUtils.createBean(DatabaseConfigurationContext.class, dbProps);
+        if (context.getBasicDatabaseName() == null)
+        {
+            throw new ConfigurationFailureException("db basic name not specified in " + dbProps);
+        }
+        if (context.getDatabaseEngineCode() == null)
+        {
+            throw new ConfigurationFailureException("db engine code not specified in " + dbProps);
+        }
+        String versionClass = dbProps.getProperty(VERSION_HOLDER_CLASS_KEY);
+        if (versionClass == null)
+        {
+            throw new ConfigurationFailureException("version holder class not specified in "
+                    + dbProps);
+        }
+        IDatabaseVersionHolder versionHolder =
+                ClassUtils.create(IDatabaseVersionHolder.class, versionClass);
+        String version = versionHolder.getDatabaseVersion();
+        DBMigrationEngine.createOrMigrateDatabaseAndGetScriptProvider(context, version);
+        return context.getDataSource();
+    }
+}
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDataSourceFactory.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDataSourceFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..bb041e3152b6f785c76a42b72acb26b83707534b
--- /dev/null
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDataSourceFactory.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ch.systemsx.cisd.openbis.dss.generic.server;
+
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+interface IDataSourceFactory
+{
+    DataSource create(Properties dbProps);
+}
\ No newline at end of file
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDatabaseVersionHolder.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDatabaseVersionHolder.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f38cd3e5dd6ebdcb739ed079c7a16255ed9ea84
--- /dev/null
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/IDatabaseVersionHolder.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.dss.generic.server;
+
+/**
+ * Stores the current version of a database.
+ * 
+ * @author Izabela Adamczyk
+ */
+public interface IDatabaseVersionHolder
+{
+    String getDatabaseVersion();
+}
\ No newline at end of file
diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/ServiceProvider.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/ServiceProvider.java
index aabe40e943618578a08b9394f2124d6f9d7bd82e..64d7e94c8ae6d871b22c7230b245c5fe5e446c01 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/ServiceProvider.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/ServiceProvider.java
@@ -22,6 +22,8 @@ import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
 
 import com.marathon.util.spring.StreamSupportingHttpInvokerServiceExporter;
 
+import ch.systemsx.cisd.openbis.dss.generic.server.DataSourceManager;
+
 /**
  * Provider of remote service onto openBIS.
  * 
@@ -58,6 +60,11 @@ public class ServiceProvider
                 .getBean("data-store-rpc-service-generic"));
     }
 
+    public static DataSourceManager getDataSourceProvider()
+    {
+        return ((DataSourceManager) APPLICATION_CONTEXT.getBean("data-source-provider"));
+    }
+
     private ServiceProvider()
     {
     }
diff --git a/datastore_server/source/java/dssApplicationContext.xml b/datastore_server/source/java/dssApplicationContext.xml
index f3edd30708b43456758787a3481430dfaaff8812..bedafb41206a3564aa3cc95775a90d108c29f1bf 100644
--- a/datastore_server/source/java/dssApplicationContext.xml
+++ b/datastore_server/source/java/dssApplicationContext.xml
@@ -78,6 +78,7 @@
     
     <bean id="session-token-manager" class="ch.systemsx.cisd.openbis.dss.generic.server.SessionTokenManager"/>
     
+    <bean id="data-source-provider" class="ch.systemsx.cisd.openbis.dss.generic.server.DataSourceProvider" />
     
     <!-- 
         // This discovers on-the-fly all <code>org.springframework.aop.Advisor</code> implementations.
diff --git a/integration-tests/templates/datastore_server_yeastx/etc/service.properties b/integration-tests/templates/datastore_server_yeastx/etc/service.properties
index 161ba5f0a029d0b43a05632cbb1d61dd9ef7d833..770f8ddfde2c084fba4d3a8e158c2312a992bf53 100644
--- a/integration-tests/templates/datastore_server_yeastx/etc/service.properties
+++ b/integration-tests/templates/datastore_server_yeastx/etc/service.properties
@@ -52,12 +52,15 @@ download-url = https://localhost:8444
 # SMTP properties (must start with 'mail' to be considered). 
 mail.smtp.host = file://${root}
 
-yeastx-databaseEngineCode = postgresql
-yeastx-basicDatabaseName = metabol
-yeastx-databaseKind = dev
-yeastx-readOnlyGroup = metabol_readonly
-yeastx-readWriteGroup = metabol_readwrite
-yeastx-scriptFolder = sql
+data-sources = metabol-db
+
+metabol-db.version-holder-class = ch.systemsx.cisd.yeastx.db.MetabolDatabaseVersionHolder
+metabol-db.databaseEngineCode = postgresql
+metabol-db.basicDatabaseName = metabol
+metabol-db.databaseKind = dev
+metabol-db.readOnlyGroup = metabol_readonly
+metabol-db.readWriteGroup = metabol_readwrite
+metabol-db.scriptFolder = sql
 
 # ---------------------------------------------------------------------------
 
@@ -67,9 +70,7 @@ plugin-services = chromatogram-image-download-servlet
 chromatogram-image-download-servlet.class = ch.systemsx.cisd.openbis.dss.yeastx.server.EICMLChromatogramGeneratorServlet
 # URL which will be mapped to this servlet
 chromatogram-image-download-servlet.path = /datastore_server/chromatogram
-chromatogram-image-download-servlet.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-chromatogram-image-download-servlet.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-chromatogram-image-download-servlet.database.databaseKind = ${yeastx-databaseKind}
+chromatogram-image-download-servlet.data-source = metabol-db
 
 
 # ------------------------
@@ -85,12 +86,7 @@ eicml-chromatograms-reporter.dataset-types = EICML
 eicml-chromatograms-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-chromatograms-reporter.properties-file = 
-eicml-chromatograms-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatograms-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatograms-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatograms-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatograms-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatograms-reporter.database.scriptFolder = ${yeastx-scriptFolder}
+eicml-chromatograms-reporter.data-source = metabol-db
 
 # Label of the plugin which will be shown for the users.
 eicml-runs-reporter.label = Show eicML runs
@@ -100,9 +96,7 @@ eicml-runs-reporter.dataset-types = EICML
 eicml-runs-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLRunsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-runs-reporter.properties-file = 
-eicml-runs-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-runs-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-runs-reporter.database.databaseKind = ${yeastx-databaseKind}
+eicml-runs-reporter.data-source = metabol-db
 
 # Label of the plugin which will be shown for the users.
 eicml-chromatogram-images-reporter.label = Show eicML chromatogram images
@@ -112,12 +106,7 @@ eicml-chromatogram-images-reporter.dataset-types = EICML
 eicml-chromatogram-images-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramImagesReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-chromatogram-images-reporter.properties-file = 
-eicml-chromatogram-images-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatogram-images-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatogram-images-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatogram-images-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatogram-images-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatogram-images-reporter.database.scriptFolder = ${yeastx-scriptFolder}
+eicml-chromatogram-images-reporter.data-source = metabol-db
 
 # ------------------------
 
@@ -184,9 +173,7 @@ main-thread.storage-processor.entity-separator = .
 main-thread.storage-processor.processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 main-thread.storage-processor.processor.unique-sample-name-property-code = ${sample-name-property-code}
 main-thread.storage-processor.processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-main-thread.storage-processor.processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-main-thread.storage-processor.processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-main-thread.storage-processor.processor.database.databaseKind = ${yeastx-databaseKind}
+main-thread.storage-processor.processor.data-source = metabol-db
 main-thread.storage-processor.processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------------------------------------------------------------------
@@ -217,9 +204,7 @@ eicml-uploader.type-extractor.is-measured = false
 eicml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 eicml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 eicml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-eicml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+eicml-uploader.storage-processor.data-source = metabol-db
 eicml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads fiaML files
@@ -248,9 +233,7 @@ fiaml-uploader.type-extractor.is-measured = false
 fiaml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 fiaml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 fiaml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-fiaml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-fiaml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-fiaml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+fiaml-uploader.storage-processor.data-source = metabol-db
 fiaml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads quantML files
@@ -280,7 +263,5 @@ quantml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.QuantMLStorageP
 quantml-uploader.storage-processor.preprocessing-script = ${gain-write-access-script}
 quantml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 quantml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-quantml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-quantml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-quantml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+quantml-uploader.storage-processor.data-source = metabol-db
 quantml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
\ No newline at end of file
diff --git a/rtd_yeastx/etc/service.properties b/rtd_yeastx/etc/service.properties
index 7147734f347b79e634ecb72596015db77df455dd..7caa67c9549fedc8ad0ac0f9f6b7a149db04ef18 100644
--- a/rtd_yeastx/etc/service.properties
+++ b/rtd_yeastx/etc/service.properties
@@ -57,12 +57,14 @@ mail.from = datastore_server@localhost
 mail.smtp.user = 
 mail.smtp.password = 
 
-yeastx-databaseEngineCode = postgresql
-yeastx-basicDatabaseName = metabol
-yeastx-databaseKind = dev
-yeastx-readOnlyGroup = metabol_readonly
-yeastx-readWriteGroup = metabol_readwrite
-yeastx-scriptFolder = sql
+data-sources = metabol-db
+metabol-db.version-holder-class = ch.systemsx.cisd.yeastx.db.MetabolDatabaseVersionHolder
+metabol-db.databaseEngineCode = postgresql
+metabol-db.basicDatabaseName = metabol
+metabol-db.databaseKind = dev
+metabol-db.readOnlyGroup = metabol_readonly
+metabol-db.readWriteGroup = metabol_readwrite
+metabol-db.scriptFolder = sql
 
 # ---------------------------------------------------------------------------
 
@@ -70,9 +72,7 @@ yeastx-scriptFolder = sql
 
 ds-remover.class = ch.systemsx.cisd.yeastx.etl.MetabolDatabaseUpdater
 ds-remover.interval = 10
-ds-remover.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-ds-remover.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-ds-remover.database.databaseKind = ${yeastx-databaseKind}
+ds-remover.data-source = metabol-db
 
 # ---------------------------------------------------------------------------
 
@@ -82,10 +82,7 @@ plugin-services = chromatogram-image-download-servlet
 chromatogram-image-download-servlet.class = ch.systemsx.cisd.openbis.dss.yeastx.server.EICMLChromatogramGeneratorServlet
 # URL which will be mapped to this servlet
 chromatogram-image-download-servlet.path = /datastore_server/chromatogram
-chromatogram-image-download-servlet.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-chromatogram-image-download-servlet.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-chromatogram-image-download-servlet.database.databaseKind = ${yeastx-databaseKind}
-
+chromatogram-image-download-servlet.data-source = metabol-db
 
 # ------------------------
 
@@ -99,13 +96,8 @@ eicml-chromatograms-reporter.dataset-types = EICML
 # Plugin class specification (together with the list of packages this class belongs to).
 eicml-chromatograms-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
-eicml-chromatograms-reporter.properties-file = 
-eicml-chromatograms-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatograms-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatograms-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatograms-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatograms-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatograms-reporter.database.scriptFolder = ${yeastx-scriptFolder}
+eicml-chromatograms-reporter.properties-file =
+eicml-chromatograms-reporter.data-source = metabol-db 
 
 # Label of the plugin which will be shown for the users.
 eicml-runs-reporter.label = Show eicML runs
@@ -115,9 +107,7 @@ eicml-runs-reporter.dataset-types = EICML
 eicml-runs-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLRunsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-runs-reporter.properties-file = 
-eicml-runs-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-runs-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-runs-reporter.database.databaseKind = ${yeastx-databaseKind}
+eicml-runs-reporter.data-source = metabol-db 
 
 # Label of the plugin which will be shown for the users.
 eicml-chromatogram-images-reporter.label = Show eicML chromatogram images
@@ -127,21 +117,7 @@ eicml-chromatogram-images-reporter.dataset-types = EICML
 eicml-chromatogram-images-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramImagesReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-chromatogram-images-reporter.properties-file = 
-eicml-chromatogram-images-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatogram-images-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatogram-images-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatogram-images-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatogram-images-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatogram-images-reporter.database.scriptFolder = ${yeastx-scriptFolder}
-
-# ------------------------
-
-archiver.class = ch.systemsx.cisd.yeastx.etl.MLArchiverTask
-archiver.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-archiver.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-archiver.database.databaseKind = ${yeastx-databaseKind}
-archiver.unique-sample-name-property-code = ${sample-name-property-code}
-archiver.unique-experiment-name-property-code = ${experiment-name-property-code}
+eicml-chromatogram-images-reporter.data-source = metabol-db 
 
 # ------------------------
 
@@ -208,9 +184,7 @@ main-thread.storage-processor.entity-separator = .
 main-thread.storage-processor.processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 main-thread.storage-processor.processor.unique-sample-name-property-code = ${sample-name-property-code}
 main-thread.storage-processor.processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-main-thread.storage-processor.processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-main-thread.storage-processor.processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-main-thread.storage-processor.processor.database.databaseKind = ${yeastx-databaseKind}
+main-thread.storage-processor.processor.data-source = metabol-db
 main-thread.storage-processor.processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------------------------------------------------------------------
@@ -241,9 +215,7 @@ eicml-uploader.type-extractor.is-measured = false
 eicml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 eicml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 eicml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-eicml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+eicml-uploader.storage-processor.data-source = metabol-db
 eicml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads fiaML files
@@ -272,9 +244,7 @@ fiaml-uploader.type-extractor.is-measured = false
 fiaml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 fiaml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 fiaml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-fiaml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-fiaml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-fiaml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+fiaml-uploader.storage-processor.data-source = metabol-db
 fiaml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads quantML files
@@ -304,8 +274,10 @@ quantml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.QuantMLStorageP
 quantml-uploader.storage-processor.preprocessing-script = ${gain-write-access-script}
 quantml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 quantml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-quantml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-quantml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-quantml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+quantml-uploader.storage-processor.data-source = metabol-db
 quantml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
+archiver.class = ch.systemsx.cisd.yeastx.etl.MLArchiverTask
+archiver.unique-sample-name-property-code = ${sample-name-property-code}
+archiver.unique-experiment-name-property-code = ${experiment-name-property-code}
+archiver.data-source = metabol-db
\ No newline at end of file
diff --git a/rtd_yeastx/resource/examples/config/service.properties b/rtd_yeastx/resource/examples/config/service.properties
index d0873aec566457a288dc280eb936421c1a42feae..7caa67c9549fedc8ad0ac0f9f6b7a149db04ef18 100644
--- a/rtd_yeastx/resource/examples/config/service.properties
+++ b/rtd_yeastx/resource/examples/config/service.properties
@@ -57,12 +57,14 @@ mail.from = datastore_server@localhost
 mail.smtp.user = 
 mail.smtp.password = 
 
-yeastx-databaseEngineCode = postgresql
-yeastx-basicDatabaseName = metabol
-yeastx-databaseKind = dev
-yeastx-readOnlyGroup = metabol_readonly
-yeastx-readWriteGroup = metabol_readwrite
-yeastx-scriptFolder = sql
+data-sources = metabol-db
+metabol-db.version-holder-class = ch.systemsx.cisd.yeastx.db.MetabolDatabaseVersionHolder
+metabol-db.databaseEngineCode = postgresql
+metabol-db.basicDatabaseName = metabol
+metabol-db.databaseKind = dev
+metabol-db.readOnlyGroup = metabol_readonly
+metabol-db.readWriteGroup = metabol_readwrite
+metabol-db.scriptFolder = sql
 
 # ---------------------------------------------------------------------------
 
@@ -70,9 +72,7 @@ yeastx-scriptFolder = sql
 
 ds-remover.class = ch.systemsx.cisd.yeastx.etl.MetabolDatabaseUpdater
 ds-remover.interval = 10
-ds-remover.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-ds-remover.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-ds-remover.database.databaseKind = ${yeastx-databaseKind}
+ds-remover.data-source = metabol-db
 
 # ---------------------------------------------------------------------------
 
@@ -82,10 +82,7 @@ plugin-services = chromatogram-image-download-servlet
 chromatogram-image-download-servlet.class = ch.systemsx.cisd.openbis.dss.yeastx.server.EICMLChromatogramGeneratorServlet
 # URL which will be mapped to this servlet
 chromatogram-image-download-servlet.path = /datastore_server/chromatogram
-chromatogram-image-download-servlet.databaseEngineCode = ${yeastx-databaseEngineCode}
-chromatogram-image-download-servlet.basicDatabaseName = ${yeastx-basicDatabaseName}
-chromatogram-image-download-servlet.databaseKind = ${yeastx-databaseKind}
-
+chromatogram-image-download-servlet.data-source = metabol-db
 
 # ------------------------
 
@@ -99,13 +96,8 @@ eicml-chromatograms-reporter.dataset-types = EICML
 # Plugin class specification (together with the list of packages this class belongs to).
 eicml-chromatograms-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
-eicml-chromatograms-reporter.properties-file = 
-eicml-chromatograms-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatograms-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatograms-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatograms-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatograms-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatograms-reporter.database.scriptFolder = ${yeastx-scriptFolder}
+eicml-chromatograms-reporter.properties-file =
+eicml-chromatograms-reporter.data-source = metabol-db 
 
 # Label of the plugin which will be shown for the users.
 eicml-runs-reporter.label = Show eicML runs
@@ -115,9 +107,7 @@ eicml-runs-reporter.dataset-types = EICML
 eicml-runs-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLRunsReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-runs-reporter.properties-file = 
-eicml-runs-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-runs-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-runs-reporter.database.databaseKind = ${yeastx-databaseKind}
+eicml-runs-reporter.data-source = metabol-db 
 
 # Label of the plugin which will be shown for the users.
 eicml-chromatogram-images-reporter.label = Show eicML chromatogram images
@@ -127,12 +117,7 @@ eicml-chromatogram-images-reporter.dataset-types = EICML
 eicml-chromatogram-images-reporter.class = ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramImagesReporter
 # The property file. Its content will be passed as a parameter to the plugin.
 eicml-chromatogram-images-reporter.properties-file = 
-eicml-chromatogram-images-reporter.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-chromatogram-images-reporter.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-chromatogram-images-reporter.database.databaseKind = ${yeastx-databaseKind}
-eicml-chromatogram-images-reporter.database.readOnlyGroup = ${yeastx-readOnlyGroup}
-eicml-chromatogram-images-reporter.database.readWriteGroup = ${yeastx-readWriteGroup}
-eicml-chromatogram-images-reporter.database.scriptFolder = ${yeastx-scriptFolder}
+eicml-chromatogram-images-reporter.data-source = metabol-db 
 
 # ------------------------
 
@@ -199,9 +184,7 @@ main-thread.storage-processor.entity-separator = .
 main-thread.storage-processor.processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 main-thread.storage-processor.processor.unique-sample-name-property-code = ${sample-name-property-code}
 main-thread.storage-processor.processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-main-thread.storage-processor.processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-main-thread.storage-processor.processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-main-thread.storage-processor.processor.database.databaseKind = ${yeastx-databaseKind}
+main-thread.storage-processor.processor.data-source = metabol-db
 main-thread.storage-processor.processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------------------------------------------------------------------
@@ -232,9 +215,7 @@ eicml-uploader.type-extractor.is-measured = false
 eicml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 eicml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 eicml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-eicml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-eicml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-eicml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+eicml-uploader.storage-processor.data-source = metabol-db
 eicml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads fiaML files
@@ -263,9 +244,7 @@ fiaml-uploader.type-extractor.is-measured = false
 fiaml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.StorageProcessorWithMLUploader
 fiaml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 fiaml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-fiaml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-fiaml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-fiaml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
+fiaml-uploader.storage-processor.data-source = metabol-db
 fiaml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 
 # ---------------- plugin properties for the thread which uploads quantML files
@@ -295,7 +274,10 @@ quantml-uploader.storage-processor = ch.systemsx.cisd.yeastx.etl.QuantMLStorageP
 quantml-uploader.storage-processor.preprocessing-script = ${gain-write-access-script}
 quantml-uploader.storage-processor.unique-sample-name-property-code = ${sample-name-property-code}
 quantml-uploader.storage-processor.unique-experiment-name-property-code = ${experiment-name-property-code}
-quantml-uploader.storage-processor.database.databaseEngineCode = ${yeastx-databaseEngineCode}
-quantml-uploader.storage-processor.database.basicDatabaseName = ${yeastx-basicDatabaseName}
-quantml-uploader.storage-processor.database.databaseKind = ${yeastx-databaseKind}
-quantml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
\ No newline at end of file
+quantml-uploader.storage-processor.data-source = metabol-db
+quantml-uploader.storage-processor.processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
+
+archiver.class = ch.systemsx.cisd.yeastx.etl.MLArchiverTask
+archiver.unique-sample-name-property-code = ${sample-name-property-code}
+archiver.unique-experiment-name-property-code = ${experiment-name-property-code}
+archiver.data-source = metabol-db
\ No newline at end of file
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/openbis/dss/yeastx/server/EICMLChromatogramGeneratorServlet.java b/rtd_yeastx/source/java/ch/systemsx/cisd/openbis/dss/yeastx/server/EICMLChromatogramGeneratorServlet.java
index 35aafcdf202b7527f86b680a8355aff1724ad203..dff4522b02c99a9cca71dc628a9c7bcbc3ee132d 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/openbis/dss/yeastx/server/EICMLChromatogramGeneratorServlet.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/openbis/dss/yeastx/server/EICMLChromatogramGeneratorServlet.java
@@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.dss.yeastx.server;
 
 import java.io.IOException;
 import java.util.Enumeration;
-import java.util.Properties;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -27,11 +26,11 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
+import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDatasetDownloadServlet;
+import ch.systemsx.cisd.openbis.dss.generic.server.DataSourceManager;
+import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
 import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.eicml.ChromatogramDTO;
 import ch.systemsx.cisd.yeastx.eicml.EICMLChromatogramImageGenerator;
@@ -167,29 +166,18 @@ public class EICMLChromatogramGeneratorServlet extends AbstractDatasetDownloadSe
         // Only initialize the dataSource once
         if (dataSource != null)
             return;
-
-        Properties dbProperties = new Properties();
-        String name;
-        while (parameterNames.hasMoreElements())
+        String dataSourceName = servletConfig.getInitParameter(DataSourceManager.DATA_SOURCE_KEY);
+        if (dataSourceName == null)
         {
-            name = parameterNames.nextElement();
-            dbProperties.setProperty(name, servletConfig.getInitParameter(name));
+            throw new ConfigurationFailureException("Data source not defined.");
         }
-
-        final DatabaseConfigurationContext dbContext = DBUtils.createAndInitDBContext(dbProperties);
-        this.dataSource = dbContext.getDataSource();
-
+        this.dataSource = ServiceProvider.getDataSourceProvider().getDataSource(dataSourceName);
     }
 
     // remember to close the query after using it!
     private IEICMSRunDAO createQuery()
     {
-        return createQuery(dataSource);
-    }
-
-    private static IEICMSRunDAO createQuery(DataSource dataSource)
-    {
-        return QueryTool.getQuery(dataSource, IEICMSRunDAO.class);
+        return DBUtils.getQuery(dataSource, IEICMSRunDAO.class);
     }
 
     @Override
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
index 42d437ed91de75e36abe000ebe780ae9ebf42d49..4c11d14d03c9d405dce646cbdff73cc12033f8ca 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
@@ -16,68 +16,27 @@
 
 package ch.systemsx.cisd.yeastx.db;
 
-import java.util.Properties;
+import javax.sql.DataSource;
 
+import net.lemnik.eodsql.BaseQuery;
+import net.lemnik.eodsql.InvalidDataTypeException;
+import net.lemnik.eodsql.InvalidQueryException;
 import net.lemnik.eodsql.QueryTool;
 import net.lemnik.eodsql.TransactionQuery;
 
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.common.utilities.BeanUtils;
-import ch.systemsx.cisd.common.utilities.ExtendedProperties;
-import ch.systemsx.cisd.dbmigration.DBMigrationEngine;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
-
 /**
- * Database utilities. Call {@link #init(DatabaseConfigurationContext)} before working with the
- * database.
+ * Database utilities.
  * 
  * @author Bernd Rinn
  */
 public class DBUtils
 {
-    /** Current version of the database. */
-    public static final String DATABASE_VERSION = "004";
-
-    private static final String DATABASE_PROPERTIES_PREFIX = "database.";
 
     static
     {
         QueryTool.getTypeMap().put(float[].class, new FloatArrayMapper());
     }
 
-    public static DatabaseConfigurationContext createAndInitDBContext(Properties properties)
-    {
-        final Properties dbProps =
-                ExtendedProperties.getSubset(properties, DATABASE_PROPERTIES_PREFIX, true);
-        final DatabaseConfigurationContext dbContext = DBUtils.createDBContext(dbProps);
-        DBUtils.init(dbContext);
-        return dbContext;
-    }
-
-    public static DatabaseConfigurationContext createDBContext(Properties dbProps)
-    {
-        DatabaseConfigurationContext context =
-                BeanUtils.createBean(DatabaseConfigurationContext.class, dbProps);
-        if (context.getBasicDatabaseName() == null)
-        {
-            throw new EnvironmentFailureException("db basic name not specified in " + dbProps);
-        }
-        if (context.getDatabaseEngineCode() == null)
-        {
-            throw new EnvironmentFailureException("db engine code not specified in " + dbProps);
-        }
-        return context;
-    }
-
-    /**
-     * Checks the database specified by <var>context</var> and migrates it to the current version if
-     * necessary.
-     */
-    public static void init(DatabaseConfigurationContext context)
-    {
-        DBMigrationEngine.createOrMigrateDatabaseAndGetScriptProvider(context, DATABASE_VERSION);
-    }
-
     /**
      * Rolls backs and closes the given <var>transactionOrNull</var>, if it is not <code>null</code>
      * .
@@ -178,4 +137,14 @@ public class DBUtils
         experiment.setId(experimentId);
         return experiment;
     }
+
+    /**
+     * Use this method instead of {@link QueryTool#getQuery(DataSource, Class)} to initialize the
+     * {@link QueryTool#getTypeMap()}.
+     */
+    public static <T extends BaseQuery> T getQuery(final DataSource dataSource, final Class<T> query)
+            throws InvalidDataTypeException, InvalidQueryException
+    {
+        return QueryTool.getQuery(dataSource, query);
+    }
 }
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/MetabolDatabaseVersionHolder.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/MetabolDatabaseVersionHolder.java
new file mode 100644
index 0000000000000000000000000000000000000000..e8ed02a5b44355862b85e05ef4cfc8370c25e099
--- /dev/null
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/MetabolDatabaseVersionHolder.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.yeastx.db;
+
+import ch.systemsx.cisd.openbis.dss.generic.server.IDatabaseVersionHolder;
+
+/**
+ * Stores current version of metabol database.
+ * 
+ * @author Izabela Adamczyk
+ */
+public class MetabolDatabaseVersionHolder implements IDatabaseVersionHolder
+{
+    /** Current version of the database. */
+    static final String DATABASE_VERSION = "004";
+
+    public String getDatabaseVersion()
+    {
+        return DATABASE_VERSION;
+    }
+
+}
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/AbstractEICMLDatastoreReportingPlugin.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/AbstractEICMLDatastoreReportingPlugin.java
index e2cc1edbd774369392928ff3f2ff868f276730a4..16beabf1ed06490571ec4b37e218555abd529e5d 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/AbstractEICMLDatastoreReportingPlugin.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/AbstractEICMLDatastoreReportingPlugin.java
@@ -22,11 +22,10 @@ import java.util.Properties;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
+import ch.systemsx.cisd.openbis.dss.generic.server.DataSourceManager;
 import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractDatastorePlugin;
 import ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IReportingPluginTask;
+import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel;
 import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
 import ch.systemsx.cisd.yeastx.db.DBUtils;
@@ -44,23 +43,19 @@ abstract public class AbstractEICMLDatastoreReportingPlugin extends AbstractData
     /** creates a report for specified datasets using a given DAO. */
     abstract protected TableModel createReport(List<DatasetDescription> datasets, IEICMSRunDAO query);
 
-    private final DataSource dataSource;
+    private final String dataSourceName;
 
     public AbstractEICMLDatastoreReportingPlugin(Properties properties, File storeRoot)
     {
         super(properties, storeRoot);
-        final DatabaseConfigurationContext dbContext = DBUtils.createAndInitDBContext(properties);
-        this.dataSource = dbContext.getDataSource();
-    }
-
-    private IEICMSRunDAO createQuery()
-    {
-        return QueryTool.getQuery(dataSource, IEICMSRunDAO.class);
+        dataSourceName = DataSourceManager.extractDataSourceName(properties);
     }
 
     public TableModel createReport(List<DatasetDescription> datasets)
     {
-        IEICMSRunDAO query = createQuery();
+        DataSource dataSource =
+                ServiceProvider.getDataSourceProvider().getDataSource(dataSourceName);
+        IEICMSRunDAO query = DBUtils.getQuery(dataSource, IEICMSRunDAO.class);
         try
         {
             return createReport(datasets, query);
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICML2Database.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICML2Database.java
index 41c74a08be07a7b3f0554aa90bb86eb72461969f..4856dfc6072b46684cd006a4ff87ce7f95ed781d 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICML2Database.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICML2Database.java
@@ -22,9 +22,8 @@ import java.util.List;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
 import ch.systemsx.cisd.yeastx.db.AbstractDatasetLoader;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 import ch.systemsx.cisd.yeastx.db.IGenericDAO;
 import ch.systemsx.cisd.yeastx.eicml.EICMLParser.IChromatogramObserver;
@@ -54,7 +53,7 @@ public class EICML2Database extends AbstractDatasetLoader
 
     public EICML2Database(DataSource datasource)
     {
-        this.dao = QueryTool.getQuery(datasource, IEICMSRunDAO.class);
+        this.dao = DBUtils.getQuery(datasource, IEICMSRunDAO.class);
     }
 
     /**
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
index a5f81b33371c385c6bfb4c37f3dba6ae50487d8a..f3debfcbac1ad83c98753af146ea3819ed7abda5 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java
@@ -26,13 +26,12 @@ import javax.sql.DataSource;
 import org.apache.commons.io.FilenameUtils;
 
 import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.etlserver.IDataSetUploader;
+import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
 import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample;
-import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 import ch.systemsx.cisd.yeastx.db.IDatasetLoader;
 import ch.systemsx.cisd.yeastx.eicml.EICML2Database;
@@ -68,8 +67,7 @@ public class ML2DatabaseUploader implements IDataSetUploader
 
     public ML2DatabaseUploader(Properties properties)
     {
-        final DatabaseConfigurationContext dbContext = DBUtils.createAndInitDBContext(properties);
-        DataSource dataSource = dbContext.getDataSource();
+        DataSource dataSource = ServiceProvider.getDataSourceProvider().getDataSource(properties);
         this.eicML2Database = new EICML2Database(dataSource);
         this.fiaML2Database = new FIAML2Database(dataSource);
         this.quantML2Database = new QuantML2Database(dataSource);
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MLArchiverTask.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MLArchiverTask.java
index 3d491715ad661cfb8eec09aea10e61fed3beeeae..f90543d1d3e2786d9f96cabe5d3e6fb3583fce58 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MLArchiverTask.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MLArchiverTask.java
@@ -21,10 +21,8 @@ import java.util.Properties;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
+import ch.systemsx.cisd.openbis.dss.generic.server.DataSourceManager;
 import ch.systemsx.cisd.openbis.dss.generic.server.plugins.standard.AbstractArchiverProcessingPlugin;
 import ch.systemsx.cisd.openbis.dss.generic.shared.ServiceProvider;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
@@ -46,9 +44,14 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin
 
     private static final long serialVersionUID = 1L;
 
+    private final String dataSourceName;
+
     public MLArchiverTask(Properties properties, File storeRoot)
     {
         super(properties, storeRoot, null, null);
+        dataSourceName = DataSourceManager.extractDataSourceName(properties);
+        // Check if given data source exists
+        getDataSource(dataSourceName);
     }
 
     /**
@@ -57,7 +60,9 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin
     @Override
     protected void archive(DatasetDescription dataset) throws UserFailureException
     {
-        final IGenericDAO dao = createQuery(properties);
+
+        DataSource dataSource = getDataSource(dataSourceName);
+        final IGenericDAO dao = DBUtils.getQuery(dataSource, IGenericDAO.class);
         try
         {
             dao.deleteDataSet(dataset.getDatasetCode());
@@ -72,11 +77,9 @@ public class MLArchiverTask extends AbstractArchiverProcessingPlugin
         }
     }
 
-    private static IGenericDAO createQuery(Properties properties)
+    private static DataSource getDataSource(String dataSourceName)
     {
-        final DatabaseConfigurationContext dbContext = DBUtils.createAndInitDBContext(properties);
-        DataSource dataSource = dbContext.getDataSource();
-        return QueryTool.getQuery(dataSource, IGenericDAO.class);
+        return ServiceProvider.getDataSourceProvider().getDataSource(dataSourceName);
     }
 
     /**
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MetabolDatabaseUpdater.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MetabolDatabaseUpdater.java
index d6393dab0d505ddb14a005ba4f1ff3ba1400c5d4..81c37b7a4f91142d5c46d1cb391666d39dd35984 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MetabolDatabaseUpdater.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/MetabolDatabaseUpdater.java
@@ -15,11 +15,7 @@
  */
 package ch.systemsx.cisd.yeastx.etl;
 
-import java.util.Properties;
-
-import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.etlserver.plugins.DataSetDeletionMaintenanceTask;
-import ch.systemsx.cisd.yeastx.db.DBUtils;
 
 /**
  * Maintenance task deleting from metabol database data sets which have been deleted from openbis.
@@ -28,15 +24,4 @@ import ch.systemsx.cisd.yeastx.db.DBUtils;
  */
 public class MetabolDatabaseUpdater extends DataSetDeletionMaintenanceTask
 {
-    @Override
-    protected DatabaseConfigurationContext createDatabaseConfigurationContext(Properties properties)
-    {
-        return DBUtils.createDBContext(properties);
-    }
-
-    @Override
-    protected void init(DatabaseConfigurationContext databaseConfigurationContext)
-    {
-        DBUtils.init(databaseConfigurationContext);
-    }
 }
\ No newline at end of file
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAML2Database.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAML2Database.java
index af2e0a7b4a48a4ebd56e2f5be194039cca9791c8..d39c187757bcaf50aebecf926a19bf340b0e3e38 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAML2Database.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAML2Database.java
@@ -22,9 +22,8 @@ import java.util.Iterator;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
 import ch.systemsx.cisd.yeastx.db.AbstractDatasetLoader;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 import ch.systemsx.cisd.yeastx.db.IGenericDAO;
 import ch.systemsx.cisd.yeastx.fiaml.FIAMLParser.IMSRunObserver;
@@ -78,7 +77,7 @@ public class FIAML2Database extends AbstractDatasetLoader
 
     public FIAML2Database(DataSource datasource)
     {
-        this.dao = QueryTool.getQuery(datasource, IFIAMSRunDAO.class);
+        this.dao = DBUtils.getQuery(datasource, IFIAMSRunDAO.class);
     }
 
     /**
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/mzxml/MzXml2Database.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/mzxml/MzXml2Database.java
index 6994ba08de5c28a9613122972cdd157637f66057..876d18475c1eda23b6c62f5686aac212f352b11a 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/mzxml/MzXml2Database.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/mzxml/MzXml2Database.java
@@ -23,12 +23,11 @@ import java.util.List;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
 import ch.rinn.restrictions.Private;
 import ch.systemsx.cisd.common.exceptions.NotImplementedException;
 import ch.systemsx.cisd.common.exceptions.UserFailureException;
 import ch.systemsx.cisd.yeastx.db.AbstractDatasetLoader;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 import ch.systemsx.cisd.yeastx.db.IGenericDAO;
 import ch.systemsx.cisd.yeastx.mzxml.dto.MzPrecursorDTO;
@@ -48,7 +47,7 @@ public class MzXml2Database extends AbstractDatasetLoader
 
     public MzXml2Database(DataSource datasource)
     {
-        this(QueryTool.getQuery(datasource, IMzXmlDAO.class));
+        this(DBUtils.getQuery(datasource, IMzXmlDAO.class));
     }
 
     @Private
diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java
index ef7db3f11e1f5fa86e5c1abc433cc1b43f06f690..4f3140903036295463b4c502383b0d6a6eb694a0 100644
--- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java
+++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java
@@ -22,9 +22,8 @@ import java.util.List;
 
 import javax.sql.DataSource;
 
-import net.lemnik.eodsql.QueryTool;
-
 import ch.systemsx.cisd.yeastx.db.AbstractDatasetLoader;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 import ch.systemsx.cisd.yeastx.db.IGenericDAO;
 import ch.systemsx.cisd.yeastx.quant.dto.ConcentrationCompounds;
@@ -44,7 +43,7 @@ public class QuantML2Database extends AbstractDatasetLoader
 
     public QuantML2Database(DataSource datasource)
     {
-        this.dao = QueryTool.getQuery(datasource, IQuantMSDAO.class);
+        this.dao = DBUtils.getQuery(datasource, IQuantMSDAO.class);
     }
 
     /**
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/AbstractDBTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/AbstractDBTest.java
index 17a5bfd23bbcc0ace937ccd379cd43c54c5f6dfc..3c38734248dc6726f9e3cdd4465c1d28fd1f1335 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/AbstractDBTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/AbstractDBTest.java
@@ -35,7 +35,7 @@ public abstract class AbstractDBTest
     static
     {
         LogInitializer.init();
-        DBUtils.init(getDatabaseContext());
+        DBUtilsForTests.init(getDatabaseContext());
     }
 
     protected DataSource datasource;
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/DBUtilsForTests.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/DBUtilsForTests.java
new file mode 100644
index 0000000000000000000000000000000000000000..f1426116fab85689aafffa4da4d4f7da8a36349b
--- /dev/null
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/db/DBUtilsForTests.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.yeastx.db;
+
+import ch.rinn.restrictions.Friend;
+import ch.systemsx.cisd.dbmigration.DBMigrationEngine;
+import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
+
+/**
+ * Utilities for dealing with databases in tests.
+ * 
+ * @author Izabela Adamczyk
+ */
+@Friend(toClasses = MetabolDatabaseVersionHolder.class)
+public class DBUtilsForTests
+{
+
+    public static void init(DatabaseConfigurationContext context)
+    {
+        DBMigrationEngine.createOrMigrateDatabaseAndGetScriptProvider(context,
+                MetabolDatabaseVersionHolder.DATABASE_VERSION);
+    }
+}
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/EICMLTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/EICMLTest.java
index 8b2f654310603dfa76b5922cd47bc4c539488191..3e6af129b797efcec8db6cb66f114e913c09a0ae 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/EICMLTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/EICMLTest.java
@@ -24,7 +24,6 @@ import java.sql.SQLException;
 import java.text.ParseException;
 
 import net.lemnik.eodsql.DataIterator;
-import net.lemnik.eodsql.QueryTool;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.testng.AssertJUnit;
@@ -32,6 +31,7 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 
 /**
@@ -49,7 +49,7 @@ public class EICMLTest extends AbstractDBTest
     @BeforeMethod(alwaysRun = true)
     public void setDAO() throws SQLException
     {
-        eicmlDAO = QueryTool.getQuery(datasource, IEICMSRunDAO.class);
+        eicmlDAO = DBUtils.getQuery(datasource, IEICMSRunDAO.class);
     }
 
     @Test
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ListChromatogramLabels.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ListChromatogramLabels.java
index 783a844973a2bcbda8c34c95e71ed5446b4b2950..1105526f8f587f35911b60892f240f59168bba13 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ListChromatogramLabels.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ListChromatogramLabels.java
@@ -19,12 +19,12 @@ package ch.systemsx.cisd.yeastx.eicml;
 import java.sql.SQLException;
 
 import net.lemnik.eodsql.DataIterator;
-import net.lemnik.eodsql.QueryTool;
 import net.lemnik.eodsql.TransactionQuery;
 
 import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
 import ch.systemsx.cisd.yeastx.db.DBUtils;
+import ch.systemsx.cisd.yeastx.db.DBUtilsForTests;
 
 /**
  * A method for listing all chromatogram labels of all runs.
@@ -37,12 +37,12 @@ public class ListChromatogramLabels
     public static void main(String[] args) throws SQLException
     {
         final DatabaseConfigurationContext context = AbstractDBTest.createDefaultDBContext();
-        DBUtils.init(context);
+        DBUtilsForTests.init(context);
         TransactionQuery transaction = null;
         try
         {
             final IEICMSRunDAO dao =
-                    QueryTool.getQuery(context.getDataSource(), IEICMSRunDAO.class);
+                    DBUtils.getQuery(context.getDataSource(), IEICMSRunDAO.class);
             transaction = dao;
             if (args.length > 0)
             {
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ReadChromatogramsPerformanceTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ReadChromatogramsPerformanceTest.java
index 4134148227dd19d8fe055394011ab3a8340a4d44..d6851fbe7d1b8ae44e4cf6c631a12c41ce4ff342 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ReadChromatogramsPerformanceTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/eicml/ReadChromatogramsPerformanceTest.java
@@ -18,16 +18,16 @@ package ch.systemsx.cisd.yeastx.eicml;
 
 import java.sql.SQLException;
 
-import net.lemnik.eodsql.QueryTool;
 import net.lemnik.eodsql.TransactionQuery;
 
 import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext;
 import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
 import ch.systemsx.cisd.yeastx.db.DBUtils;
+import ch.systemsx.cisd.yeastx.db.DBUtilsForTests;
 
 /**
  * A performance test of reading all chromatograms from the database.
- *
+ * 
  * @author Bernd Rinn
  */
 public class ReadChromatogramsPerformanceTest
@@ -35,13 +35,14 @@ public class ReadChromatogramsPerformanceTest
 
     public static void main(String[] args) throws SQLException
     {
-        final DatabaseConfigurationContext context =  AbstractDBTest.createDefaultDBContext();
-        DBUtils.init(context);
+        final DatabaseConfigurationContext context = AbstractDBTest.createDefaultDBContext();
+        DBUtilsForTests.init(context);
         TransactionQuery transaction = null;
         long start = System.currentTimeMillis();
         try
         {
-            final IEICMSRunDAO dao = QueryTool.getQuery(context.getDataSource(), IEICMSRunDAO.class);
+            final IEICMSRunDAO dao =
+                    DBUtils.getQuery(context.getDataSource(), IEICMSRunDAO.class);
             for (EICMSRunDTO run : dao.getMsRuns())
             {
                 // We need to iterate over the chromatograms to make sure they are really read.
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLTest.java
index 1edf03db09dd78b828b457f21512e9b03508b812..559d12316258ae46a794026c7c3fb35fd060ee84 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLTest.java
@@ -23,7 +23,6 @@ import java.io.File;
 import java.sql.SQLException;
 
 import net.lemnik.eodsql.DataIterator;
-import net.lemnik.eodsql.QueryTool;
 
 import org.springframework.dao.DataIntegrityViolationException;
 import org.testng.annotations.AfterMethod;
@@ -46,7 +45,7 @@ public class FIAMLTest extends AbstractDBTest
     @BeforeMethod(alwaysRun = true)
     public void setDAO() throws SQLException
     {
-        fiamsDAO = QueryTool.getQuery(datasource, IFIAMSRunDAO.class);
+        fiamsDAO = DBUtils.getQuery(datasource, IFIAMSRunDAO.class);
     }
 
     @AfterMethod(alwaysRun = true)
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/mzxml/MzXmlDAOTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/mzxml/MzXmlDAOTest.java
index c4c5b49ee4ceec83f1d9b686335148c3e30ac0c7..d3f6c0b3cd1e4bd431716d6178ec5e4607a8b452 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/mzxml/MzXmlDAOTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/mzxml/MzXmlDAOTest.java
@@ -19,13 +19,12 @@ package ch.systemsx.cisd.yeastx.mzxml;
 import java.io.File;
 import java.sql.SQLException;
 
-import net.lemnik.eodsql.QueryTool;
-
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 
 /**
@@ -38,7 +37,7 @@ public class MzXmlDAOTest extends AbstractDBTest
     @BeforeMethod(alwaysRun = true)
     public void setDAO() throws SQLException
     {
-        dao = QueryTool.getQuery(datasource, IMzXmlDAO.class);
+        dao = DBUtils.getQuery(datasource, IMzXmlDAO.class);
     }
 
     @AfterMethod(alwaysRun = true)
diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java
index 95de9c5edb850b65bf7af97aecc687c86d73fe64..7ef67e5b061d01ee16f15b588698b18d4b2dc18b 100644
--- a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java
+++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java
@@ -19,13 +19,12 @@ package ch.systemsx.cisd.yeastx.quant;
 import java.io.File;
 import java.sql.SQLException;
 
-import net.lemnik.eodsql.QueryTool;
-
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.yeastx.db.AbstractDBTest;
+import ch.systemsx.cisd.yeastx.db.DBUtils;
 import ch.systemsx.cisd.yeastx.db.DMDataSetDTO;
 
 /**
@@ -38,7 +37,7 @@ public class QuantMSDAOTest extends AbstractDBTest
     @BeforeMethod(alwaysRun = true)
     public void setDAO() throws SQLException
     {
-        dao = QueryTool.getQuery(datasource, IQuantMSDAO.class);
+        dao = DBUtils.getQuery(datasource, IQuantMSDAO.class);
     }
 
     @AfterMethod(alwaysRun = true)