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-sms/src/org/ametys/plugins/sms/dao/SubscriberDAO.java
===================================================================
--- main/plugin-sms/src/org/ametys/plugins/sms/dao/SubscriberDAO.java	(revision 38915)
+++ main/plugin-sms/src/org/ametys/plugins/sms/dao/SubscriberDAO.java	(working copy)
@@ -36,6 +36,7 @@
 import org.ametys.core.datasource.ConnectionHelper;
 import org.ametys.core.ui.Callable;
 import org.ametys.plugins.sms.SMSHelper;
+import org.ametys.runtime.config.Config;
 import org.ametys.runtime.parameter.ParameterHelper;
 
 /**
@@ -135,16 +136,16 @@
      */
     public boolean numberAlreadyExists(String phoneNumber, String list)
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {    
             
             String sql = "SELECT * FROM SMS_Subscribers WHERE PhoneNumber = ? AND ListId = ?";
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
             stmt.setString(1, phoneNumber);
             stmt.setString(2, list);
 
@@ -161,7 +162,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
 
@@ -173,16 +173,15 @@
      */
     public void insertNumber(String phoneNumber, String list) throws SQLException
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
-            
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {     
             String sqlUpdate = "INSERT INTO SMS_Subscribers (PhoneNumber, ListId, date) VALUES (?, ?, ?)";
            
-            stmt = con.prepareStatement(sqlUpdate);
+            stmt = connection.prepareStatement(sqlUpdate);
             stmt.setString(1, phoneNumber);
             stmt.setString(2, list);
             
@@ -197,7 +196,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
     
@@ -209,17 +207,16 @@
      */
     public void deleteNumber(String phoneNumber, String list) throws SQLException
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
-            
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {      
             String sql = "DELETE FROM SMS_Subscribers WHERE PhoneNumber = ?"
                         + (list != null ? " AND ListId = ?" : "");
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
             stmt.setString(1, phoneNumber);
             if (list != null)
             {
@@ -232,7 +229,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }  
     }
     
@@ -242,16 +238,15 @@
      */
     public void deleteAllNumbers(String list)
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
-            
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {    
             String sql = "DELETE FROM SMS_Subscribers WHERE ListId = ? ";
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
             stmt.setString(1, list);
             
             stmt.execute();
@@ -264,7 +259,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }  
     }
     
@@ -276,16 +270,15 @@
      */
     public HashMap<String, String> getPhoneNumbersFromList(String list) throws SQLException
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
-            
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {     
             String sql = "SELECT PhoneNumber, Date FROM SMS_Subscribers WHERE ListId = ?";
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
             stmt.setString(1, list);
 
             rs = stmt.executeQuery();
@@ -302,7 +295,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
     
@@ -313,16 +305,15 @@
      */
     public HashMap<String, Integer> getNbUserFromList() throws SQLException 
     {
-        Connection con = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
-        try
-        {
-            con = ConnectionHelper.getConnection(ConnectionHelper.CORE_POOL_NAME);    
-            
+        
+        String dataSourceId = Config.getInstance().getValueAsString(ConnectionHelper.CORE_POOL_CONFIG_PARAM);
+        try (Connection connection = ConnectionHelper.getConnection(dataSourceId);)
+        {      
             String sql = "SELECT s1.ListId, (SELECT count(*) FROM SMS_Subscribers s2 WHERE s1.ListId = s2.ListId) as nb FROM SMS_Subscribers s1";
             
-            stmt = con.prepareStatement(sql);
+            stmt = connection.prepareStatement(sql);
 
             rs = stmt.executeQuery();
     
@@ -338,7 +329,6 @@
         {
             ConnectionHelper.cleanup(rs);
             ConnectionHelper.cleanup(stmt);
-            ConnectionHelper.cleanup(con);
         }
     }
 
