db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald McLean" <dmclea...@gmail.com>
Subject Re: Can we force create a database?
Date Mon, 10 Nov 2008 13:19:52 GMT
It shouldn't be all that tedious. Here's the code that I wrote. I use
it to delete the database in some of my unit tests:

    public static boolean deleteAnyFile(File file)
//        System.out.println("[DBUtilities.deleteAnyFile] enter.");
        if (!file.exists())
            return true;

        if (!file.isDirectory())
            return file.delete();

        return deleteDirectory(file);

     * @param directory - item to be deleted.
     * @return success or failure
    private static boolean deleteDirectory(File directory)
        File[] contents = directory.listFiles();
        for (int i = 0; i < contents.length; i++)
            File next = contents[i];
            boolean result = deleteAnyFile(next);
            if (!result)
                return false;

        return directory.delete();

On Sun, Nov 9, 2008 at 6:03 PM, Emmanuel Cecchet <manu@frogthinker.org> wrote:
> Hi,
> I had a situation with a crashed Derby database in a replicated scenario
> with Sequoia (so it's ok because Sequoia is ready to handle this kind of
> problems).
> However, the URL used by Sequoia was of the form
> 'jdbc:derby:mydb;create=true'. Unfortunately the database crashed in a state
> that fooled Derby so that it generates an 'ERROR XBM0J' saying that the
> directory exist and that Derby will cowardly refuse to create the database.
> Is there a way to force Derby to create the database or do we have do
> manually remove the directory content beforehand (which is quite tedious)?
> Does anyone know if the issue would be the same with createFrom instead of
> create?
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

View raw message