Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Fields and methods of the jala.db package.
jala db.Server(baseDir, port, createOnDemand, makePublic, useSsl)
Returns a new Server instance.
parameters

helma.File | baseDir | The directory where the database files are located or should be stored
Number | port | The port to listen on (defaults to 9001)
Boolean | createOnDemand | If true this server will create non-existing databases on-the-fly, if false it only accepts connections to already existing databases in the given base directory
Boolean | makePublic | If true this database is reachable from outside, if false it's only reachable from localhost
Boolean | useSsl | If true SSL will be used to encrypt the connection

methods

- getDirectory()

- getPort()

- start()

- stop()

- isRunning()

- useSsl(bool)

- createOnDemand(bool)

- isPublic(bool)

- getUrl(name, props)

- getProperties(name, username, password, props)

- getConnection(name, username, password, props)

jala db.RamDatabase(name, username, password)
Returns a newly created RamDatabase instance.
parameters

String | name | The name of the database. If not given a private un-named database is created, that can only be accessed through this instance of jala.db.RamDatabase
String | 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.RamDatabase pointing to a named database.
String | password | Optional password (defaults to "").

methods

- getName()

- getUsername()

- getPassword()

- getUrl(props)

- getProperties(props)

- getConnection(An)

- shutdown()

- dropTable(tableName)

- tableExists(name)

- copyTables(database, tables)

- runScript(file, props, charset, continueOnError)

- dump(file, props)

jala db.FileDatabase(name, directory, username, password)
Returns a newly created instance of FileDatabase.
parameters

String | name | The name of the database. This name is used as prefix for all database files
helma.File | directory | The directory where the database files should be stored in.
String | 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
String | password | Optional password (defaults to "").

methods

- getName()

- getDirectory()

- getUsername()

- getPassword()

- remove()

- backup(file)

- restore(backupFile)

jala. db
Namespace declaration
Methods
jala.db.Server. getDirectory()
Returns the directory used by this server instance
returns

| The directory where the databases used by this server are located in

jala.db.Server. getPort()
Returns the port this server listens on
returns

| The port this server listens on

jala.db.Server. start()
Starts the database server.
returns

| True in case the server started successfully, false otherwise

jala.db.Server. stop()
Stops the database server.
returns

| True if stopping the server was successful, false otherwise

jala.db.Server. isRunning()
Returns true if the database server is running.
returns

| True if the database server is running

jala.db.Server. useSsl(bool)
Toggles the use of Ssl encryption within this server. This should be set before starting the server.
parameters

Boolean | bool | If true SSL encryption will be used, false otherwise. If no argument is given, this method returns the current setting.

returns

| The current setting if no argument is given, or void

jala.db.Server. createOnDemand(bool)
If called with boolean true as argument, this server creates databases on-the-fly, otherwise it only accepts connections to already existing databases. This should be set before starting the server.
parameters

Boolean | bool | If true this server creates non-existing databases on demand, if false it only allows connections to existing databases. If no argument is given, this method returns the current setting.

returns

| The current setting if no argument is given, or void

jala.db.Server. isPublic(bool)
If called with boolean true as argument, this server accepts connections from outside localhost. This should be set before starting the server.
parameters

Boolean | bool | If true this server accepts connections from outside localhost. If no argument is given, this method returns the current setting.

returns

| The current setting if no argument is given, or void

jala.db.Server. getUrl(name, props)
Returns the JDBC Url to use for connections to a given database.
parameters

String | name | An optional name of a database running
Object | props | Optional connection properties to add

returns

| The JDBC Url to use for connecting to a database within this sever

jala.db.Server. getProperties(name, username, password, props)
Returns a properties object containing the connection properties of the database with the given name.
parameters

String | name | The name of the database
String | username | Optional username to use for this connection
String | password | Optional password to use for this connection
Object | props | An optional parameter object containing connection properties to add to the connection Url.

returns

| A properties object containing the connection properties

jala.db.Server. getConnection(name, username, password, props)
Returns a connection to a database within this server.
parameters

String | name | The name of the database running within this server
String | username | Optional username to use for this connection
String | password | Optional password to use for this connection
Object | props | An optional parameter object containing connection properties to add to the connection Url.

returns

| A connection to the specified database

jala.db.DataType. getType()
Returns the sql type code number as defined in java.sql.Types
returns

| The sql type code number of this data type

jala.db.DataType. getTypeName()
Returns the type name of this data type, which can be used in sql queries.
returns

| The type name of this data type

jala.db.DataType. getParams()
Returns the creation parameter string of this data type
returns

| The creation parameter string of this data type

jala.db.DataType. needsQuotes()
Returns true if values for this data type should be surrounded by (single) quotes.
returns

| True if values for this data type should be surrounded by quotes, false if not

jala.db.RamDatabase. getName()
Returns the name of the database
returns

| The name of the database

jala.db.RamDatabase. getUsername()
Returns the username of this database
returns

| The username of this database

jala.db.RamDatabase. getPassword()
Returns the password of this database
returns

| The password of this database

jala.db.RamDatabase. getUrl(props)
Returns the JDBC Url to connect to this database
parameters

Object | props | Optional connection properties to add

returns

| The JDBC url to use for connecting to this database

jala.db.RamDatabase. getProperties(props)
Returns a properties object containing the connection properties for this database.
parameters

Object | props | An optional parameter object containing connection properties to add to the connection Url.

returns

| A properties object containing the connection properties

jala.db.RamDatabase. getConnection(An)
Returns a connection to this database
parameters

Object | An | optional parameter object containing connection properties to add to the connection Url.

returns

| A connection to this database

jala.db.RamDatabase. shutdown()
Stops this in-process database by issueing a "SHUTDOWN" sql command.
jala.db.RamDatabase. dropTable(tableName)
Drops the table with the given name
parameters

String | tableName | The name of the table

returns

| True if the table was successfully dropped, false otherwise

jala.db.RamDatabase. tableExists(name)
Returns true if the table exists already in the database
parameters

String | name | The name of the table

returns

| True if the table exists, false otherwise

jala.db.RamDatabase. copyTables(database, tables)
Copies all tables in the database passed as argument into this embedded database. If any of the tables already exists in this database, they will be removed before re-created. Please mind that this method ignores any indexes in the source database, but respects the primary key settings.
parameters

helma.Database | database | The database to copy the tables from
Array | tables | An optional array containing the names of the tables to copy. If not given all tables are copied

jala.db.RamDatabase. runScript(file, props, charset, continueOnError)
Runs the script file passed as argument in the context of this database. Use this method to eg. create and/or populate a database.
parameters

helma.File | file | The script file to run
Object | props | Optional object containing connection properties
String | charset | Optional character set to use (defaults to "UTF-8")
Boolean | continueOnError | Optional flag indicating whether to continue on error or not (defaults to false)

returns

| True in case the script was executed successfully, false otherwise

jala.db.RamDatabase. dump(file, props)
Dumps the database schema and data into a file
parameters

helma.File | file | The file where the database dump will be
Object | props | Optional object containing connection properties

returns

| True in case the database was successfully dumped, false otherwise

jala.db.FileDatabase. 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

jala.db.FileDatabase. getDirectory()
Returns the directory where the database files are stored.
returns

| The directory where this database is stored.

jala.db.FileDatabase. getUsername()
Returns the username of this database
returns

| The username of this database

jala.db.FileDatabase. getPassword()
Returns the password of this database
returns

| The password of this database

jala.db.FileDatabase. 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

jala.db.FileDatabase. backup(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

helma.File | file | The file to write the backup to

returns

| True if the database backup was created successfully, false otherwise

jala.db.FileDatabase. restore(backupFile)
Restores this database using a backup on disk.
parameters

helma.File | backupFile | The backup file to use for restore

returns

| True if the database was successfully restored, false otherwise

Tue, 25 Nov 2008 16:50:14 GMT.

### core framework

- global
- app (application)
- req (request)
- res (response)
- session
- path
- root
- HopObject
- User
- File
- FtpClient
- Image
- Mail
- Remote
- Xml
- DatabaseObject
- MimePart
- Skin
- Object

### optional modules

- Array extensions
- Date extensions
- Number extensions
- Object extensions
- String extensions
- HopObject extensions
- global macros
- macro filters
- JSON methods
- helma.Aspects
- helma.Chart
- helma.Color
- helma.Database
- helma.File
- helma.Ftp
- helma.Group
- helma.Html
- helma.Http
- helma.Image
- helma.Mail
- helma.Search
- helma.Skin
- helma.Ssh
- helma.Url
- helma.Zip
- jala.BitTorrent
- jala.Captcha
- jala.Date
- jala.db
- jala.DnsClient
- jala.Form
- jala.History
- jala HopObject extensions
- jala.HtmlDocument
- jala.I18n
- jala.ImageFilter
- jala.IndexManager
- jala.ListRenderer
- jala.Mp3
- jala.PodcastWriter
- jala.RemoteContent
- jala.Rss20Writer
- jala.Utilities
- jala.XmlRpcRequest
- jala.XmlWriter

### java libraries

- browse docjar