Keywords: derby.storage.tempDirectory, tmp directory, setting location for

# derby.storage.tempDirectory

#### Function

Defines the location on disk for temporary file space needed by Derby for performing large sorts and deferred deletes and updates. (Temporary files are automatically deleted after use, and are removed when the database restarts after a crash.) The temporary directory named by this property will be created if it does not exist, but will not be deleted when the system shuts down. The path name specified by this property must have file separators that are appropriate to the current operating system.

This property allows databases located on read-only media to write temporary files to a writable location. If this property is not set, databases located on read-only media might get an error like the following:

    ERROR XSDF1: Exception during creation
    	of file  c:\databases\db\tmp\T887256591756.tmp
    for container
    ERROR XJ001: Java exception:
    'a:\databases\db\tmp\T887256591756.tmp: java.io.IOException'.

This property moves the temporary directories for all databases being used by the Derby system. Derby makes temporary directories for each database under the directory referenced by this property. For example, if the property is set as follows:

    derby.storage.tempDirectory=C:/Temp/dbtemp

the temporary directories for the databases in C:\databases\db1 and C:\databases\db2 will be in C:\Temp\dbtemp\db1 and C:\Temp\dbtemp\db2, respectively.

The temporary files of two databases running concurrently with the same name (e.g., C:\databases\db1 and E:\databases\db1) will conflict with each other if the derby.storage.tempDirectory property is set. This will cause incorrect results, so users are advised to give databases unique names.

#### Default

A subdirectory named tmp under the database directory.

For example, if the database db1 is stored in C:\databases\db1, the temporary files are created in C:\databases\db1\tmp.

#### Example

    -- system-wide property
    derby.storage.tempDirectory=c:/Temp/dbtemp
    -- database-wide property
    CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(
        'derby.storage.tempDirectory',
        'c:/Temp/dbtemp')

#### Dynamic or static

This property is static; you must restart Derby for a change to take effect.

Parent topic: Derby properties
Related reference
derby.authentication.ldap.searchAuthDN
derby.authentication.ldap.searchAuthPW
derby.authentication.ldap.searchBase
derby.authentication.ldap.searchFilter
derby.authentication.provider
derby.authentication.server
derby.connection.requireAuthentication
derby.database.defaultConnectionMode
derby.database.forceDatabaseLock
derby.database.fullAccessUsers
derby.database.propertiesOnly
derby.database.readOnlyAccessUsers
derby.database.sqlAuthorization
derby.infolog.append
derby.jdbc.xaTransactionTimeout
derby.language.logQueryPlan
derby.language.logStatementText
derby.locks.deadlockTimeout
derby.locks.deadlockTrace
derby.locks.escalationThreshold
derby.locks.monitor
derby.locks.waitTimeout
derby.storage.initialPages
derby.storage.minimumRecordSize
derby.storage.pageCacheSize
derby.storage.pageReservedSpace
derby.storage.pageSize
derby.stream.error.field
derby.stream.error.file
derby.stream.error.method
derby.stream.error.logSeverityLevel
derby.system.durability
derby.system.home
derby.user.UserName