You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

SlimDAO

Instead of using a static object relational database mapping, MIB Explorer uses its own lightweight and easy configurable database mapping mechanism called SlimDAO.
Basically a SlimDAO DB mapping configuration file contains SQL statements and their fragments in an XML file. Because the SQL dialects of different databases often differ only for special statements, like sequence and constraint creation, SlimDAO supports statement inheritance.
A SQL statement (or a complete script) can be defined in the default context „." and overwritten in a specific context whose name matches the JDBC driver class name for the database whose SQL dialect differs from the default context's dialect (e.g., org.postgresql.Driver for a PostgreSQL database).
Each statement and script in the mapping configuration has a unique name within its context. MIB Explorer will lookup a statement by its name. The name is hard-coded. The supported statement names are defined by the default context in the Monitor2DB.xml file from the db-monitor directory.
A statement is defined for example by the following construct:

    <statement name="select.monitor.by.id">
      SELECT * FROM @INSERT[SCHEMA].MXP_MONITOR 
		 WHERE ID = @VALUE[ID]
    </statement>

During runtime, MIB Explorer uses the statement to get monitor data from the database. It replaces the constructs of the pattern

@<TAG>[<PARAM_LIST>]

with the corresponding values as described by the table following this section. The resulting SQL statement would then be executed on the DB server as follows:

SELECT * FROM MXP.MXP_MONITOR WHERE ID = ?

The question mark (question) is a placeholder for the value within the prepared statement. The value will be inserted by the JDBC driver when the prepared statement is being executed. MIB Explorer sets the value for the statement by replacing the @VALUEID reference with the ? in the statement and setting the statements first parameter value to the value of ID (for example 2).

  • No labels