Companion

Functions

Link copied to clipboard
fun copyDatabase(sourceDB: Path, dupName: String, directory: Path)

Duplicates the database into a new database with the supplied name and directory. Assumes that the source database has no active connections and performs a file system copy

fun copyDatabase(ds: DataSource, sourceDB: Path, dupName: String, directory: Path)

Uses an active database connection and derby system commands to freeze the database, uses system OS commands to copy the database, and then unfreezes the database. The duplicate name and directory path must not already exist

Link copied to clipboard
Link copied to clipboard
open override fun createDatabase(dbName: String, dbDir: Path): Database

If the database already exists it is deleted

Link copied to clipboard
open override fun createDataSource(pathToDb: Path): DataSource
fun createDataSource(pathToDb: Path, user: String? = null, pWord: String? = null, create: Boolean = false): DataSource
fun createDataSource(dbName: String, dbDir: Path = KSL.dbDir, user: String? = null, pWord: String? = null, create: Boolean = false): DataSource
Link copied to clipboard
fun databaseExists(fullPath: Path): Boolean
fun databaseExists(dbName: String, dbDir: Path): Boolean
Link copied to clipboard
open override fun deleteDatabase(pathToDb: Path)

This does not check if the database is shutdown. It simply removes the database from the file system. If it doesn't exist, then nothing happens.

Link copied to clipboard
open override fun isDatabase(path: Path): Boolean

There is no way to guarantee with 100 percent certainty that the path is in fact an embedded derby database because someone could be faking the directory structure. The database directory of an embedded derby database must have a service.properties file, a log directory, and a seg0 directory. If these exist and the supplied path is a directory, then the method returns true.

open fun isDatabase(file: File): Boolean

A convenience method for those that use File instead of Path. Calls isEmbeddedDerbyDatabase(file.toPath())

Link copied to clipboard
open override fun openDatabase(pathToDb: Path): Database
fun openDatabase(dbName: String, dbDir: Path): Database

The database must already exist. It is not created. An exception is thrown if it does not exist.

open fun openDatabase(fileName: String): Database

The database file must already exist within the KSLDatabase.dbDir directory It is opened for reading and writing.

Link copied to clipboard
fun shutDownDatabase(pathToDb: Path, user: String? = null, pWord: String? = null): Boolean

Sends a shutdown connection to the database.

Link copied to clipboard
fun shutDownDataSource(pathToDb: Path, user: String? = null, pWord: String? = null): DataSource
fun shutDownDataSource(dbName: String, user: String? = null, pWord: String? = null): DataSource

Creates a data source that can be used to shut down an embedded derby database upon first connection.