diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
index a9b702e1a47062830a050d697fe13c48453be362..0869b8fc13dc257dd28c1b806ee7f71cd50661c5 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java
@@ -1287,10 +1287,11 @@ final class DataDAO extends AbstractGenericEntityWithPropertiesDAO<DataPE> imple
     public boolean confirmStorage(String dataSetCode)
     {
         SQLQuery query =
-                getSession()
-                        .createSQLQuery(
-                                "update external_data set storage_confirmation = true where storage_confirmation = false and data_id in (select id from data_all where code = :code)");
-        query.setString("code", dataSetCode);
+                getSession().createSQLQuery(
+                        "update external_data set storage_confirmation = true "
+                                + "where storage_confirmation = false "
+                                + "and data_id in (select id from data_all where code = :code)");
+        query.setString("code", CodeConverter.tryToDatabase(dataSetCode));
         return query.executeUpdate() > 0;
     }
 
@@ -1299,7 +1300,7 @@ final class DataDAO extends AbstractGenericEntityWithPropertiesDAO<DataPE> imple
     {
         SQLQuery query =
                 getSession().createSQLQuery("select count(*) from data_all where code = :code");
-        query.setString("code", dataSetCode);
+        query.setString("code", CodeConverter.tryToDatabase(dataSetCode));
         Number count = (Number) query.uniqueResult();
         return count != null && count.intValue() > 0;
     }