Hi Donald,
It shouldn't be all that tedious. Here's the code that I wrote.
Thanks for your code.
I guess the issue is that when you have a database agnostic program
where you are just supposed to provide a datasource definition and then
you would use CREATE DATABASE or DROP DATABASE. I wanted to avoid to
make something Derby specific but it looks like there is no other way.
Thanks for your feedback,
Emmanuel
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 <[EMAIL PROTECTED]> 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.
--
Emmanuel Cecchet
FTO @ Frog Thinker
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: [EMAIL PROTECTED]
Skype: emmanuel_cecchet