Ok, that's more or less what I'm doing :)
I just wanted to check if there was some "official" way to get this
info inside the derby engine.
I also used System.getProperty("file.separator") instead of "/" in
order to be platform independent.
Thanks!
Nuno
On Jul 27, 2007, at 11:50 , Ole Gunnar Borstad wrote:
If you have the BasicDatabase instance of the database you want to
know the name of, you can do this:
BasicDatabase db;
//this gives the whole path
String databaseName =
org.apache.derby.iapi.services.monitor.Monitor.getMonitor
().getServiceName(db);
//if you only want the name, remove the path
databaseName = databaseName.substring(databaseName.lastIndexOf("/")
+ 1);
This should be "safe"... :)
Ole Gunnar
Siterer Nuno Carvalho <[EMAIL PROTECTED]>:
Hi all,
thanks for all the answers!
I'm working inside the derby engine and I found a way to do this. I
found that the BasicDatabase.java receives some properties when its
booted and one of them (derby.__rt.serviceDirectory) has the full
path
of the database in the directory service, so I get the database name
from it.
Can you tell me if this is save? Is there a more clean way to get the
database name in the source code?
Thanks for all your help!
Cheers,
nuno
On Jul 26, 2007, at 1:35 , Dag H. Wanvik wrote:
Nuno Carvalho <[EMAIL PROTECTED]> writes:
Hi all,
I need to list the existing databases of derby. Can someone help me
on this? Is there a way to query the list of available created
databases or is this information is this information available
inside
The databases are booted individually inside a Derby system. The
databases are essentially self contained. Even inspecting the file
system under the default location ${derby.system.home} doesn't
necessarily find all databases created, since they may be created
and
accessed using explicit paths. It would be possible to list
databases
*booted* in the present Derby system, but as far as I know there
is no
such functionality.
Dag
--
Nuno Carvalho
University of Lisbon, Portugal
http://lasige.di.fc.ul.pt/~ncarvalho
--
Nuno Carvalho
University of Lisbon, Portugal
http://lasige.di.fc.ul.pt/~ncarvalho