diff --git a/.classpath b/.classpath
index bfbe1725010acc11dfee02824a4f84833ba28177..29da2e33763ed748a62a900468970277d9db2c32 100644
--- a/.classpath
+++ b/.classpath
@@ -2,7 +2,9 @@
 <classpath>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
 	<classpathentry excluding="**" including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/.project b/.project
index a4743907b8b54a7b2a121b98404e3a97a2bb4107..b7b141e10df9c56f83d66859b2f2e596f5a8febf 100644
--- a/.project
+++ b/.project
@@ -20,8 +20,14 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
 		<nature>org.maven.ide.eclipse.maven2Nature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
diff --git a/pom.xml b/pom.xml
index 065a575d0e44213e5dea2ec14127ad7ac61f258a..6499d60d99fc70597c57dea89dfceaac69d7c705 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
   </parent>
   <groupId>fr.soleil.deviceservers</groupId>
   <artifactId>hdbtdbArchivingServers</artifactId>
-  <version>2.3.10-SNAPSHOT</version>
+  <version>2.3.10</version>
   <name>hdbtdbArchivingServers</name>
   <developers>
     <developer>
diff --git a/src/main/java/HdbArchiver/Collector/DbProxy.java b/src/main/java/HdbArchiver/Collector/DbProxy.java
index 0a30be808e384de2219e53dc330673255d4bb395..4ac8cdecc920c054281037d7b6966b99a72c3984 100644
--- a/src/main/java/HdbArchiver/Collector/DbProxy.java
+++ b/src/main/java/HdbArchiver/Collector/DbProxy.java
@@ -303,6 +303,12 @@ public final class DbProxy {
 	periods.put(completeName, period);
     }
 
+    public void closeConnection() {
+	if (manager != null) {
+	    manager.closeConnection();
+	}
+    }
+
     /*
      * (non-Javadoc)
      * 
diff --git a/src/main/java/HdbArchiver/HdbArchiver.java b/src/main/java/HdbArchiver/HdbArchiver.java
index 3931d67e3c58717ddc3f889511a1248ec222ff3c..5ba68141934d78feab04c591d628557395a84244 100644
--- a/src/main/java/HdbArchiver/HdbArchiver.java
+++ b/src/main/java/HdbArchiver/HdbArchiver.java
@@ -425,6 +425,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 
     protected int state;
     private DbProxy dbProxy;
+    private boolean databaseConnectionFault = false;
+    private InitDeviceTask initDeviceTast;
 
     // --------- Start of attributes data members ----------
 
@@ -454,6 +456,7 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
      * <b>Default value : </b> Class Value
      */
     private String dbUser;
+
     /**
      * Password used to connect the database HDB. <br>
      * <b>Default value : </b> Class Value
@@ -608,44 +611,61 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 
 	get_logger().info("HdbArchiver() create " + device_name);
 
-	// Initialise variables to default values
-	// -------------------------------------------
-	get_device_property();
+	if (databaseConnectionFault) {
+	    get_logger().error(
+		    "The connection with the database hasn't been made previously, "
+			    + "so you'll need to restart the device to make the connection work correctly.");
+	} else {
+	    // Initialise variables to default values
+	    // -------------------------------------------
+	    get_device_property();
 
-	try {
-	    logger = LoggingUtils.configureLogging(device_name, hasDiary, diaryPath, diaryLogLevel);
-	} catch (final IOException e) {
-	    TangoStateUtils.setFault(this, "logging configuration failed");
-	}
+	    try {
+		logger = LoggingUtils.configureLogging(device_name, hasDiary, diaryPath, diaryLogLevel);
+	    } catch (final IOException e) {
+		TangoStateUtils.setFault(this, "logging configuration failed");
+	    }
+
+	    collectorFactory = new HdbCollectorFactory(logger);
+	    attr_image_charge_read = 0;
+	    attr_spectrum_charge_read = 0;
+	    attr_scalar_charge_read = 0;
+	    koAttributes.clear();
+	    okAttributes.clear();
+
+	    logger.info("DbHost = " + dbHost);
+	    logger.info("DbName = " + dbName);
+	    logger.info("dbUser = " + dbUser);
+	    logger.info("DbPassword = " + dbPassword);
+	    logger.info("RacConnection  = " + RacConnection);
+	    logger.info("HasThreadedStartup = " + hasThreadedStartup);
+	    logger.info("isDedicated = " + isDedicated);
+	    logger.info("reservedAttributes = " + Arrays.toString(reservedAttributes));
+	    logger.info("diaryPath = " + diaryPath);
+	    logger.info("hasDiary = " + hasDiary);
+	    logger.info("diaryLogLevel = " + diaryLogLevel);
+
+	    connect_database();
 
-	collectorFactory = new HdbCollectorFactory(logger);
-	attr_image_charge_read = 0;
-	attr_spectrum_charge_read = 0;
-	attr_scalar_charge_read = 0;
-	koAttributes.clear();
-	okAttributes.clear();
-	logger.info("DbHost = " + dbHost);
-	logger.info("DbName = " + dbName);
-	logger.info("dbUser = " + dbUser);
-	logger.info("DbPassword = " + dbPassword);
-	logger.info("RacConnection  = " + RacConnection);
-	logger.info("HasThreadedStartup = " + hasThreadedStartup);
-	logger.info("isDedicated = " + isDedicated);
-	logger.info("reservedAttributes = " + Arrays.toString(reservedAttributes));
-	logger.info("diaryPath = " + diaryPath);
-	logger.info("hasDiary = " + hasDiary);
-	logger.info("diaryLogLevel = " + diaryLogLevel);
+	}
+	logger.debug("init done");
+    }
 
+    private void connect_database() {
 	try {
 	    dbProxy = new DbProxy(dbHost, dbName, dbSchema, dbUser, dbPassword, RacConnection, logger);
 	    // setControlMode(safetyPeriod);
 	    // start archiving in a thread
-	    Executors.newSingleThreadExecutor().submit(new InitDeviceTask());
+	    if (initDeviceTast == null) {
+		initDeviceTast = new InitDeviceTask();
+	    }
+	    Executors.newSingleThreadExecutor().submit(initDeviceTast);
+
 	} catch (final ArchivingException e) {
 	    TangoStateUtils.setFault(this, "Historical database connection failed: " + e);
 	    logger.error("ERROR : Database unconnected !!", e);
+	    databaseConnectionFault = true;
 	}
-	logger.debug("init done");
     }
 
     /**
@@ -676,6 +696,7 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 	    try {
 		myCurrentTasks = dbProxy.getArchiverCurrentTasks(device_name);
 	    } catch (final ArchivingException e) {
+		e.printStackTrace();
 		logger.debug("cannot getArchiverCurrentTasks " + e);
 		TangoStateUtils.setFault(HdbArchiver.this, e.getMessage());
 	    }
@@ -974,7 +995,23 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
     // =========================================================
     @Override
     public void always_executed_hook() throws DevFailed {
-
+	// Uncomment to allow the device to trying reconnection when a commend
+	// is triggered. May not work with Oracle jdbc drivers.
+
+	// System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> always executed hook");
+	// System.out.println("======================================== isDbProxy null : "
+	// + (dbProxy == null));
+	// if (dbProxy != null) {
+	// System.out.println("======================================== isDbConnected : "
+	// + dbProxy.isDbConnected());
+	// }
+	//
+	// if (dbProxy == null || (dbProxy != null && !dbProxy.isDbConnected()))
+	// {
+	// logger.info("Trying to reconnect database...");
+	// delete_device();
+	// init_device();
+	// }
     }
 
     // ===================================================================
@@ -1796,7 +1833,11 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 
     @Override
     public void delete_device() throws DevFailed {
-	Except.throw_exception("not supported", "please, restart device", "delete_device");
+	// if (dbProxy != null && dbProxy.isDbConnected()) {
+	// dbProxy.closeConnection();
+	// // Except.throw_exception("not supported", "please, restart device",
+	// // "delete_device");
+	// }
     }
 }
 
diff --git a/src/main/java/TdbArchiver/TdbArchiver.java b/src/main/java/TdbArchiver/TdbArchiver.java
index 33500f7e510ec32517578545c29a063a5bfcad95..5ef4c785a6c389a3914988d70bf9496c6e35389f 100644
--- a/src/main/java/TdbArchiver/TdbArchiver.java
+++ b/src/main/java/TdbArchiver/TdbArchiver.java
@@ -576,6 +576,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
     private String dbSchema;
     private Logger logger;
 
+    private boolean databaseConnectionFault = false;
+
     // --------------------------------------
 
     // =========================================================
@@ -623,46 +625,57 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
     // =========================================================
     @Override
     public void init_device() throws DevFailed {
+	System.out.println("-------------------------------------- init_device in");
 
-	get_logger().info("TdbArchiver() create " + device_name);
-	get_device_property();
+	if (databaseConnectionFault) {
+	    get_logger().error(
+		    "The connection with the database hasn't been made previously, "
+			    + "so you'll need to restart the device to make the connection work correctly.");
+	} else {
 
-	try {
-	    logger = LoggingUtils.configureLogging(device_name, hasDiary, diaryPath, diaryLogLevel);
-	} catch (final IOException e) {
-	    TangoStateUtils.setFault(this, "logging configuration failed");
-	}
+	    get_logger().info("TdbArchiver() create " + device_name);
+	    get_device_property();
+
+	    try {
+		logger = LoggingUtils.configureLogging(device_name, hasDiary, diaryPath, diaryLogLevel);
+	    } catch (final IOException e) {
+		TangoStateUtils.setFault(this, "logging configuration failed");
+	    }
 
-	attr_image_charge_read = 0;
-	attr_spectrum_charge_read = 0;
-	attr_scalar_charge_read = 0;
-	koAttributes.clear();
-	okAttributes.clear();
-	get_logger().info("dbHost = " + dbHost);
-	get_logger().info("dbName = " + dbName);
-
-	get_logger().info("dbUser = " + dbUser);
-	get_logger().info("dbPassword = " + dbPassword);
-	get_logger().info("Rac Connection  = " + RacConnection);
-	get_logger().info("dsPath = " + dsPath);
-	get_logger().info("dbPath = " + dbPath);
-	get_logger().info("hasThreadedStartup = " + hasThreadedStartup);
-	get_logger().info("hasDiary = " + hasDiary);
-	get_logger().info("diaryLogLevel = " + diaryLogLevel);
-	get_logger().info("diaryPath = " + diaryPath);
-	get_logger().info("isDedicated = " + isDedicated);
-	get_logger().info("reservedAttributes = " + traceStrings(reservedAttributes));
-
-	collectorFactory = new TdbCollectorFactory(logger, dsPath, dbPath);
+	    attr_image_charge_read = 0;
+	    attr_spectrum_charge_read = 0;
+	    attr_scalar_charge_read = 0;
+	    koAttributes.clear();
+	    okAttributes.clear();
+	    get_logger().info("dbHost = " + dbHost);
+	    get_logger().info("dbName = " + dbName);
+
+	    get_logger().info("dbUser = " + dbUser);
+	    get_logger().info("dbPassword = " + dbPassword);
+	    get_logger().info("Rac Connection  = " + RacConnection);
+	    get_logger().info("dsPath = " + dsPath);
+	    get_logger().info("dbPath = " + dbPath);
+	    get_logger().info("hasThreadedStartup = " + hasThreadedStartup);
+	    get_logger().info("hasDiary = " + hasDiary);
+	    get_logger().info("diaryLogLevel = " + diaryLogLevel);
+	    get_logger().info("diaryPath = " + diaryPath);
+	    get_logger().info("isDedicated = " + isDedicated);
+	    get_logger().info("reservedAttributes = " + traceStrings(reservedAttributes));
+
+	    collectorFactory = new TdbCollectorFactory(logger, dsPath, dbPath);
 
-	try {
-	    dbProxy = new DbProxy(dbHost, dbName, dbSchema, dbUser, dbPassword, RacConnection);
-	    Executors.newSingleThreadExecutor().submit(new InitDeviceTask());
-	} catch (final ArchivingException e) {
-	    TangoStateUtils.setFault(this, "Historical database connection failed: " + e);
-	    logger.error("ERROR : Database unconnected !!");
+	    try {
+		dbProxy = new DbProxy(dbHost, dbName, dbSchema, dbUser, dbPassword, RacConnection);
+		Executors.newSingleThreadExecutor().submit(new InitDeviceTask());
+	    } catch (final ArchivingException e) {
+		TangoStateUtils.setFault(this, "Historical database connection failed: " + e);
+		logger.error("ERROR : Database unconnected !!");
+		databaseConnectionFault = true;
+	    }
 	}
 
+	System.out.println("------------------------------------- init_device out");
+
     }
 
     private String traceStrings(final String[] reservedAttributes2) {
@@ -1481,7 +1494,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 
     @Override
     public void delete_device() throws DevFailed {
-	Except.throw_exception("not supported", "please, restart device", "delete_device");
+	// Except.throw_exception("not supported", "please, restart device",
+	// "delete_device");
     }
 
 }