db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nadav Hoze <Nadav.H...@dbMotion.com>
Subject Problem to restore backup to an existing databse
Date Mon, 14 Jun 2010 13:23:48 GMT

I'm using derby in embedded mode, and I have a test which checks backup and restore functionality
by doing the followings:
  1. save an Entity and then backup.
  2. save another entity and then restore.
  3. check that the first entity exist.
  4. check that the second entity does not exist.

The test fails because somehow the second entity does exist.
I looked at the backup DB and it does not contain more than one entity (as it should).
But the "restored DB" is the same (i.e. contains 2 entities).

This is how I backup:

        Connection connection = DriverManager.getConnection("jdbc:derby:CTS_SYNCH");
        String sqlstmt = "CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE(?)";
        CallableStatement cs = connection.prepareCall(sqlstmt);

This is how I Restore:

         connection = DriverManager.getConnection("jdbc:derby:CTS_SYNCH;restoreFrom=C:\IHS\CTS\trunk\Applications\Tools\synch-tool\target\backup\CTS_SYNCH"
                    , new Properties());

Now if I use a different location in restore operation for example:
connection = DriverManager.getConnection("jdbc:derby:internal/CTS_SYNCH;restoreFrom=C:\IHS\CTS\trunk\Applications\Tools\synch-tool\target\backup\CTS_SYNCH"
                    , new Properties());
The database is restored from backup to internal correctly (i.e. only 1 entity).
This means that the restores works but not to an existing DB.

Maybe I'm missing something in configuration, or in the coding of the restore.

I use hibernate with my configuration.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
        xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
        <persistence-unit name="CTS_SYNCH" transaction-type="RESOURCE_LOCAL">
                        <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"
                        <property name="hibernate.hbm2ddl.auto" value="update" />
                        <property name="hibernate.show_sql" value="false" />
                        <property name="hibernate.format_sql" value="false" />
                        <property name="hibernate.connection.url"
                                value="jdbc:derby:CTS_SYNCH;create=true" />
                        <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"

Please help.


Nadav Hoze
Java Programmer
dbMotion Ltd.
Direct: +972-8-6206802
Extension number: 6802
Mobile: 972-54-4821606
E-mail: nadav.hoze@dbMotion.com

dbMotion's SOA-based health interoperability and intelligence solution enables healthcare
organizations and health information exchanges (HIEs) to meaningfully integrate and leverage
their information assets, driving improvements in the quality and efficiency of patient care.
Visit dbMotion at www.dbmotion.com.

This email and any files transmitted with it are confidential and intended solely for the
use of the individual or entity to whom they are addressed. Please note that any disclosure,
copying or distribution of the content of this information is strictly forbidden. If you have
received this email message in error please notify its sender and then delete it from your

View raw message