public final class DBSystem extends Object
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this database system so it is no longer able to process queries.
|
DBConfig |
getConfig()
Returns an immutable version of the database system configuration.
|
Connection |
getConnection(String username,
String password)
Makes a connection to the database and returns a java.sql.Connection
object that can be used to execute queries on the database.
|
Connection |
getConnection(String schema,
String username,
String password)
Makes a connection to the database and returns a java.sql.Connection
object that can be used to execute queries on the database.
|
Database |
getDatabase()
Returns the com.mckoi.database.Database object for this control.
|
void |
setDeleteOnClose(boolean status)
Sets a flag that causes the database to delete itself from the file system
when it is shut down.
|
public DBConfig getConfig()
public Database getDatabase()
This object is generally not very useful unless you intend to perform some sort of low level function on the database. This object can be used to bypass the SQL layer and talk directly with the internals of the database.
public Connection getConnection(String schema, String username, String password) throws SQLException
For example, if this control is for a Mckoi database server, the java.sql.Connection returned here does not go through the TCP/IP connection. For this reason certain database configuration constraints (such as number of concurrent connection on the database) may not apply to this connection.
The java.sql.Connection returned here acts exactly as an object returned by a java.sql.MDriver object.
An SQLException is thrown if the login fails.
schema
- the initial database schema to start the connection in.username
- the user to login to the database under.password
- the password of the user.SQLException
- if authentication of the user fails.public Connection getConnection(String username, String password) throws SQLException
For example, if this control is for a Mckoi database server, the java.sql.Connection returned here does not go through the TCP/IP connection. For this reason certain database configuration constraints (such as number of concurrent connection on the database) may not apply to this connection.
The java.sql.Connection returned here acts exactly as an object returned by a java.sql.MDriver object.
An SQLException is thrown if the login fails.
username
- the user to login to the database under.password
- the password of the user.SQLException
- if authentication of the user fails.public final void setDeleteOnClose(boolean status)
By default, a database is not deleted from the file system when it is closed.
NOTE: Use with care - setting this flag will cause all data stored in the database to be lost when the database is shut down.
public void close()
When a database system is closed, it is not able to be restarted again unless a new DBSystem object is obtained from the DBController.
This method also disposes all resources associated with the database system (such as threads, etc) so that it may be reclaimed by the garbage collector.
When this method returns this object is no longer usable.
Copyright © 2015. All rights reserved.