# derby.database.forceDatabaseLock

#### Function

On some platforms, if set to true, prevents Derby from booting a database if a db.lck file is present in the database directory.

Derby attempts to prevent two JVMs from accessing a database at one time (and potentially corrupting it) with the use of a file called db.lck in the database directory. On some operating systems, the use of a lock file does not guarantee single access, and so Derby only issues a warning and might allow multiple JVM access even when the file is present. (For more information, see "Double-Booting System Behavior" in Chapter 1 of the Java DB Developer's Guide.)

Derby provides the property derby.database.forceDatabaseLock for use on platforms that do not provide the ability for Derby to guarantee single JVM access. By default, this property is set to false. When this property is set to true, if Derby finds the db.lck file when it attempts to boot the database, it throws an exception and does not boot the database.
Note: This situation can occur even when no other JVMs are accessing the database; in that case, remove the db.lck file by hand in order to boot the database. If the db.lck file is removed by hand while a JVM is still accessing a Derby database, there is no way for Derby to prevent a second VM from starting up and possibly corrupting the database. In this situation no warning message is logged to the error log.

#### Default

false

#### Example

    derby.database.forceDatabaseLock=true

#### Dynamic or static

This property is static; if you change it while Derby is running, the change does not take effect until you reboot.

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.fullAccessUsers
derby.database.noAutoBoot
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.replication.logBufferSize
derby.replication.maxLogShippingInterval
derby.replication.minLogShippingInterval
derby.replication.verbose
derby.storage.initialPages
derby.storage.minimumRecordSize
derby.storage.pageCacheSize
derby.storage.pageReservedSpace
derby.storage.pageSize
derby.storage.tempDirectory
derby.stream.error.field
derby.stream.error.file
derby.stream.error.method
derby.stream.error.logSeverityLevel
derby.system.bootAll
derby.system.durability
derby.system.home
derby.user.UserName