Fields and methods of the jala.db package.
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
- getPort()
- start()
- stop()
- useSsl(bool)
- createOnDemand(bool)
- isPublic(bool)
- getUrl(name, props)
- getProperties(name, username, password, props)
- getConnection(name, username, password, props)
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()
- getUrl(props)
- getProperties(props)
- getConnection(An)
- shutdown()
- dropTable(tableName)
- tableExists(name)
- copyTables(database, tables)
- runScript(file, props, charset, continueOnError)
- dump(file, props)
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()
- remove()
- backup(file)
- restore(backupFile)
Namespace declaration
Methods
Returns the directory used by this server instance
returns
The directory where the databases used by this server are located in |
Returns the port this server listens on
returns
The port this server listens on |
Starts the database server.
returns
True in case the server started successfully, false otherwise |
Stops the database server.
returns
True if stopping the server was successful, false otherwise |
Returns true if the database server is running.
returns
True if the database server is running |
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 |
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 |
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 |
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 |
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 |
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 |
Returns the sql type code number as defined in java.sql.Types
returns
The sql type code number of this data type |
Returns the type name of this data type, which can be
used in sql queries.
returns
The type name of this data type |
Returns the creation parameter string of this data type
returns
The creation parameter string of this data type |
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 |
Returns the username of this database
returns
The username of this database |
Returns the password of this database
returns
The password of this database |
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 |
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 |
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 |
Stops this in-process database by issueing a "SHUTDOWN" sql command.
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 |
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 |
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 |
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 |
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 |
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 |
Returns the directory where the database files are stored.
returns
The directory where this database is stored. |
Returns the username of this database
returns
The username of this database |
Returns the password of this database
returns
The password of this database |
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 |
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 |
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 |