Index: .settings/org.eclipse.jdt.core.prefs
===================================================================
--- .settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ .settings/org.eclipse.jdt.core.prefs	(revision 0)
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
Index: main/plugin-forms/src/org/ametys/plugins/forms/data/FormEntryFileReader.java
===================================================================
--- main/plugin-forms/src/org/ametys/plugins/forms/data/FormEntryFileReader.java	(revision 38915)
+++ main/plugin-forms/src/org/ametys/plugins/forms/data/FormEntryFileReader.java	(working copy)
@@ -34,6 +34,7 @@
 import org.ametys.core.datasource.ConnectionHelper.DatabaseType;
 import org.ametys.plugins.forms.table.DbTypeHelper;
 import org.ametys.plugins.forms.table.FormTableManager;
+import org.ametys.runtime.config.Config;
 
 /**
  * Reads a BLOB value of a form entry.
@@ -57,19 +58,17 @@
         
         String tableName = FormTableManager.TABLE_PREFIX + formId;
         
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
         InputStream is = null;
         
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            // Connect to the database.
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             String sql = "SELECT " + DbTypeHelper.escape(dbType, fieldId) + " FROM " + DbTypeHelper.escape(dbType, tableName) + " WHERE id = ?";
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
             
             stmt.setInt(1, entryId);
             
@@ -110,7 +109,6 @@
             
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
 }
Index: main/plugin-forms/src/org/ametys/plugins/forms/processing/ProcessFormAction.java
===================================================================
--- main/plugin-forms/src/org/ametys/plugins/forms/processing/ProcessFormAction.java	(revision 38915)
+++ main/plugin-forms/src/org/ametys/plugins/forms/processing/ProcessFormAction.java	(working copy)
@@ -24,6 +24,7 @@
 import java.io.Reader;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.sql.Types;
@@ -401,13 +402,12 @@
     {
         final String tableName = FormTableManager.TABLE_PREFIX + form.getId();
 
-        Connection con = null;
         PreparedStatement stmt = null;
-
-        try
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
 
             StringBuilder sql = new StringBuilder();
             StringBuilder values = new StringBuilder();
@@ -462,7 +462,7 @@
                 getLogger().debug("Inserting a user submission in the database :\n" + sql.toString());
             }
 
-            stmt = con.prepareStatement(sql.toString());
+            stmt = connection.prepareStatement(sql.toString());
 
             _setParameters(form, input, stmt, dbType);
 
@@ -476,7 +476,6 @@
         finally
         {
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
 
Index: main/plugin-forms/src/org/ametys/plugins/forms/table/FormTableManager.java
===================================================================
--- main/plugin-forms/src/org/ametys/plugins/forms/table/FormTableManager.java	(revision 38915)
+++ main/plugin-forms/src/org/ametys/plugins/forms/table/FormTableManager.java	(working copy)
@@ -56,6 +56,7 @@
 import org.ametys.plugins.forms.data.UserEntry;
 import org.ametys.plugins.forms.jcr.FormPropertiesManager;
 import org.ametys.plugins.repository.AmetysObjectResolver;
+import org.ametys.runtime.config.Config;
 import org.ametys.runtime.i18n.I18nizableText;
 
 /**
@@ -130,15 +131,14 @@
      */
     public boolean dropTable(String table)
     {
-        Connection con = null;
         PreparedStatement stmt = null;
-
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
+
             String request = "DROP TABLE " + table;
 
-            stmt = con.prepareStatement(request);
+            stmt = connection.prepareStatement(request);
             stmt.executeUpdate();
         }
         catch (SQLException e)
@@ -149,7 +149,6 @@
         finally
         {
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
 
         return true;
@@ -170,30 +169,25 @@
         
         final String tableName = TABLE_PREFIX + form.getId();
         
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            // Connect to the database.
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             
             String request = "SELECT * FROM " + DbTypeHelper.escape(dbType, tableName);
-            
             // Limit the results
-            DatabaseType datatype = ConnectionHelper.getDatabaseType(con);
             
-            if (datatype == DatabaseType.DATABASE_MYSQL || datatype == DatabaseType.DATABASE_POSTGRES || datatype == DatabaseType.DATABASE_HSQLDB)
+            if (dbType == DatabaseType.DATABASE_MYSQL || dbType == DatabaseType.DATABASE_POSTGRES || dbType == DatabaseType.DATABASE_HSQLDB)
             {
                 request = request + " LIMIT " + length + " OFFSET " + offset;
             }
-            else if (datatype == DatabaseType.DATABASE_ORACLE)
+            else if (dbType == DatabaseType.DATABASE_ORACLE)
             {
                 request = "select * from (select rownum r, " + DbTypeHelper.escape(dbType, tableName) + ".* from " + DbTypeHelper.escape(dbType, tableName) + ") where r BETWEEN " + (offset + 1) + " AND " + (offset + length);
             }
-            else if (datatype == DatabaseType.DATABASE_DERBY)
+            else if (dbType == DatabaseType.DATABASE_DERBY)
             {
                 request = "select * from (select ROW_NUMBER() OVER () AS ROWNUM, TR.* from " + DbTypeHelper.escape(dbType, tableName) 
                     + " AS TR ) AS TRR where ROWNUM BETWEEN " + (offset + 1) + " AND " + (offset + length);
@@ -203,7 +197,7 @@
                 getLogger().warn("The request will not have the limit and offet set, since its type is unknown");
             }
             
-            stmt = con.prepareStatement(request);
+            stmt = connection.prepareStatement(request);
             
             // Execute the query.
             rs = stmt.executeQuery();
@@ -283,7 +277,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
         
         return entries;
@@ -299,19 +292,16 @@
     {
         final String tableName = TABLE_PREFIX + form.getId();
         
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            // Connect to the database.
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             
             String request = "SELECT COUNT(*) FROM " + DbTypeHelper.escape(dbType, tableName);
             
-            stmt = con.prepareStatement(request);
+            stmt = connection.prepareStatement(request);
             
             // Execute the query.
             rs = stmt.executeQuery();
@@ -332,7 +322,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
         
         return -1;
@@ -556,14 +545,12 @@
     private boolean _createTable(String formId, Map<String, FieldValue> columns)
     {
         String tableName = TABLE_PREFIX + formId;
-        Connection con = null;
-        PreparedStatement stmt = null;
         
-        try
+        PreparedStatement stmt = null;
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
-            
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             StringBuilder sql = new StringBuilder();
             
             sql.append("CREATE TABLE ");
@@ -597,7 +584,7 @@
                 getLogger().debug("Creating table : " + sql.toString());
             }
             
-            stmt = con.prepareStatement(sql.toString());
+            stmt = connection.prepareStatement(sql.toString());
             stmt.executeUpdate();
             ConnectionHelper.cleanup(stmt);
             
@@ -605,7 +592,7 @@
             if (DatabaseType.DATABASE_ORACLE.equals(dbType))
             {
                 String sqlQuery = "create sequence seq_" + formId; 
-                stmt = con.prepareStatement(sqlQuery);
+                stmt = connection.prepareStatement(sqlQuery);
                 stmt.executeUpdate();
             }
             
@@ -619,7 +606,6 @@
         finally
         {
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
     
@@ -627,36 +613,37 @@
     {
         String tableName = TABLE_PREFIX + formId;
         
-        Connection con = null;
+        Connection connection = null;
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
         
         try
         {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
+            connection = ConnectionHelper.getConnection(dataSourceId);
             
             // Start transaction.
-            con.setAutoCommit(false);
+            connection.setAutoCommit(false);
             
             // Get the existing columns.
-            Map<String, DbColumn> existingColumns = _getExistingColumns(con, tableName);
+            Map<String, DbColumn> existingColumns = _getExistingColumns(connection, tableName);
             
             // Compute the modifications to make.
-            DbColumnModifications modifications = _getColumnsToModify(con, existingColumns, newColumns);
+            DbColumnModifications modifications = _getColumnsToModify(connection, existingColumns, newColumns);
             
             // Move the columns that were deleted or replaced.
-            _moveColumns(con, modifications.getColumnsToRemove(), existingColumns, tableName);
+            _moveColumns(connection, modifications.getColumnsToRemove(), existingColumns, tableName);
             
             // Add the new columns.
-            _addColumns(con, modifications.getColumnsToAdd(), tableName);
+            _addColumns(connection, modifications.getColumnsToAdd(), tableName);
             
             // Commit the transaction.
-            con.commit();
+            connection.commit();
         }
         catch (SQLException e)
         {
             getLogger().error("Unable to alter table " + tableName, e);
             try
             {
-                con.rollback();
+                connection.rollback();
             }
             catch (SQLException sqlex)
             {
@@ -667,7 +654,7 @@
         }
         finally
         {
-            ConnectionHelper.cleanup(con);
+            ConnectionHelper.cleanup(connection);
         }
         return true;
         
@@ -677,28 +664,27 @@
     {
         String tableName = TABLE_PREFIX + formId;
         
-        Connection con = null;
         ResultSet tables = null;
         ResultSet rs = null;
         
         Map<String, DbColumn> currentColumns = new HashMap<>();
         
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             
             tableName = DbTypeHelper.filterName(dbType, tableName);
             
-            DatabaseMetaData metadata = con.getMetaData();
-            tables = metadata.getTables(con.getCatalog(), null, tableName, null);
+            DatabaseMetaData metadata = connection.getMetaData();
+            tables = metadata.getTables(connection.getCatalog(), null, tableName, null);
             
             if (!tables.next())
             {
                 return TABLE_NOT_CREATED;
             }
             
-            currentColumns = _getExistingColumns(con, tableName);
+            currentColumns = _getExistingColumns(connection, tableName);
             
             for (String newColumn : newColumns.keySet())
             {
@@ -731,7 +717,6 @@
         {
             ConnectionHelper.cleanup(tables);
             ConnectionHelper.cleanup(rs);
-            ConnectionHelper.cleanup(con);
         }
     }
 
@@ -1034,19 +1019,16 @@
         }
         
         final String tableName = TABLE_PREFIX + form.getId();
-        
-        Connection con = null;
         PreparedStatement stmt = null;
         
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            // Connect to the database.
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             
             StringBuilder sb = new StringBuilder();
-            
             sb.append("DELETE FROM " + DbTypeHelper.escape(dbType, tableName) + " WHERE ");
+
             
             int count = 0;
             for (Integer entryId : entries)
@@ -1059,7 +1041,7 @@
                 count++;
             }
             
-            stmt = con.prepareStatement(sb.toString());
+            stmt = connection.prepareStatement(sb.toString());
             
             count = 1;
             for (Integer entryId : entries)
@@ -1079,7 +1061,6 @@
         finally
         {
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
     
@@ -1107,18 +1088,16 @@
         
         final String tableName = TABLE_PREFIX + form.getId();
         
-        Connection con = null;
         PreparedStatement stmt = null;
         
-        try
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
         {
-            // Connect to the database.
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);
-            DatabaseType dbType = ConnectionHelper.getDatabaseType(con);
+            DatabaseType dbType = ConnectionHelper.getDatabaseType(connection);
             
             String request = "DELETE FROM " + DbTypeHelper.escape(dbType, tableName);
             
-            stmt = con.prepareStatement(request);
+            stmt = connection.prepareStatement(request);
             
             // Execute the query.
             stmt.executeUpdate();
@@ -1131,7 +1110,6 @@
         finally
         {
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
     
