Creating a log in a non-default location
Derby Server and Administration Guide
83
· If the database is already created, move the log manually and update the
service.properties file.
Using the logDevice=logDirectoryPath attribute
To specify a non-default location for the log directory, set the
logDevice=logDirectoryPath
attribute on the database connection URL when you
create the database.
This attribute is meaningful only when you are creating a database. You can specify
logDevice=logDirectoryPath
as either an absolute path or as a path that is relative
to the directory where the JVM is executed.
Setting
logDevice=logDirectoryPath
on the database connection URL adds an
entry to the service.properties file. If you ever move the log manually, you will need to
alter the entry in service.properties. If you move the log back to the default location,
remove the logDevice entry from the service.properties file.
To check the log location for an existing database, you can retrieve the
logDevice=logDirectoryPath
attribute as a database property by using the
following statement:
VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY('logDevice')
For more information, see "logDevice=logDirectoryPath attribute" in the Derby Reference
Manual.
Example of creating a log in a non-default location
The following database connection URL creates a database in the directory
d:/mydatabases
, but puts the database log directory in
h:/janets/tourslog
:
jdbc:derby:d:/mydatabases/toursDB;
create=true;logDevice=h:/janets/tourslog
Example of moving a log manually
If you want to move the log to
g:/bigdisk/tourslog
, move the log with operating
system commands:
move h:\janets\tourslog\log\*.* g:\bigdisk\tourslog\log
Then, alter the logDevice entry in service.properties to read as follows:
logDevice=g:/bigdisk/toursLog
Note: You can use either a single forward slash or double back slashes for a path
separator.
If you later want to move the log back to its default location (in this case,
d:\mydatabases\toursDB\log
), move the log manually as follows:
move g:\bigdisk\tourslog\log\*.* d:\mydatabases\toursDB\log
Then, delete the logDevice entry from service.properties.
Note: This example uses commands that are specific to the Windows NT operating
system. Use commands appropriate to your operating system to copy a directory and all
of its contents to a new location.
Issues for logging in a non-default location