Overview | File | Class | Tree | Index | Help
| Jala 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class jala.db.FileDatabase

    Object
       |
       +--jala.db.RamDatabase
             |
             +--jala.db.FileDatabase

class jala.db.FileDatabase
extends jala.db.RamDatabase

Instances of this class represent a file based in-process database
Important: You need the h2.jar in directory "lib/ext" of your helma installation for this library to work, which you can get at http://www.h2database.com/.
Defined in Database.js

Constructor Summary
`jala.db.FileDatabase (<String> name, <helma.File> directory, <String> username, <String> password)` Returns a newly created instance of FileDatabase.

Method Summary
`Boolean` | `backup(<helma.File> file)` Creates a backup of this database, using the file passed as argument.
`helma.File` | `getDirectory()` Returns the directory where the database files are stored.
`String` | `getName()` Returns the name of the database.
`String` | `getPassword()` Returns the password of this database
`String` | `getUsername()` Returns the username of this database
`Boolean` | `remove()` Deletes all files of this database on disk.
`Boolean` | `restore(<helma.File> backupFile)` Restores this database using a backup on disk.

Methods inherited from class jala.db.RamDatabase
`getUrl, getProperties, getConnection, shutdown, dropTable, tableExists, copyTables, runScript, dump`

Constructor Detail

### jala.db.FileDatabase

    jala.db.FileDatabase(<String> name, <helma.File> directory, <String> username, <String> password)

Returns a newly created instance of FileDatabase.

Parameters:

`name` - The name of the database. This name is used as prefix for all database files

`directory` - The directory where the database files should be stored in.

`username` - Optional username (defaults to "sa"). This username is used when creating the database, so the same should be used when creating subsequent instances of jala.db.FileDatabase pointing to the same database

`password` - Optional password (defaults to "").

Returns:

A newly created FileDatabase instance

Method Detail

### backup

    Boolean backup(<helma.File> file)

Creates a backup of this database, using the file passed as argument. The result will be a zipped file containing the database files

Parameters:

`file` - The file to write the backup to

Returns:

True if the database backup was created successfully, false otherwise

### getDirectory

    helma.File getDirectory()

Returns the directory where the database files are stored.

Returns:

The directory where this database is stored.

### getName

    String getName()

Returns the name of the database. This name is used as prefix for all files of this database in the specified directory

Returns:

The name of the database

### getPassword

    String getPassword()

Returns the password of this database

Returns:

The password of this database

### getUsername

    String getUsername()

Returns the username of this database

Returns:

The username of this database

### remove

    Boolean remove()

Deletes all files of this database on disk. Note that this also closes the database before removing it.

Returns:

True in case the database was removed successfully, false otherwise

### restore

    Boolean restore(<helma.File> backupFile)

Restores this database using a backup on disk.

Parameters:

`backupFile` - The backup file to use for restore

Returns:

True if the database was successfully restored, false otherwise

Overview | File | Class | Tree | Index | Help
| Jala 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008