Database

Database component (pl.aislib.fm.Database class) is responsible for performing database opertations through the JDBC API. Subclass of pl.aislib.fm.jdbc.Manager is responsible for creating/pooling/closing of java.sql.Connection instances.

Initialization of a Database component consists of creating new instance of Database class with a specified subclass of Manager class. Created instance of Database should be passed to Application instance through setDatabase() method. Application sets Log component specified for logging of JDBC operations.

Instances of Connection are available within the Page with the following call: Connection con = application.getDatabase().getConnection(); and should be released with application.getDatabase().releaseConnection(con);

It is assumed that particular applications will have their own subclasses of Database class, which will be responsible for mapping between java objects and database tables. It is possible to generate set of 'java beans' like classes and subclass of 'Database' class based on XML description of database, it is described here.

There are two implementations of Manager, the one which opens and closes Connections (pl.aislib.util.jdbc.SimpleManager) and the one based on JNDI DataSources (pl.aislib.util.jdbc.JNDIManager).