|
WebNMS SNMP API allows loading MIB modules from the database. The MIB files can be stored in any RDBMS, such as MySql or Oracle. Applications can load these MIB files directly from the database.

Loading MIB files from a database gives the following advantages to applications.
Scalability - database feature is particularly useful when the number of MIB files to be loaded are high. Applications can load hundreds of MIB files at a time.
Memory Usage - Information is stored in the database and we cache only the referred node objects.
The performance of getting the node information using the database option is less than the other loading options without considering the network traffic.
The API uses Java Database Connectivity (JDBC) for the database support. Applications should use a valid JDBC driver of the respective databases to enable the database support.
To add database support for loading MIBs, applications should first
initialize the necessary database parameters. The initJdbcParams(driverName,
URL, userName, passWord)
method is used for initializing
the database parameters. The following are the arguments of the method.
driverName - Name of the database driver
URL - URL pointing to the database
userName - Name of the user
passWord - Password for the user
After initializing the database parameters, the value of the setLoadFromDatabase(boolean
flag)
method is set to true to enable the database
support. By default, the value is set to false.
When setLoadFromDatabase()
is set to true and loadMibModules(String
fileNames)
is called, the application loads the MIB
file from the database. If the MIB files are not present in the database,
the MIB files are loaded in the database and then loaded in the application.
After loading the MIB files from the database, if any changes are made
to it and loaded again, the changes will not be reflected in the loaded
MIB file. The MIB files in the database need to be overwritten. The method
setOverwriteDatabase(boolean
overWrite)
defines whether to overwrite the existing
database files.
The other methods related to database operations are:
isOverwriteDatabase()
- Gets the overwriteDataBase boolean method.
isLoadFromDatabase()
- Gets the loadFromDatabase boolean method.
The method setDatabaseName(byte
type)
is used to set the database. The APIs are
tested using the MySql and Oracle databases. The default database is MySql.
If you want to set the database to Oracle, the type is set as MibOperations.ORACLE.
In case of loading MIBs from a database other than MySql in overwrite
option, the method setDatabaseName(byte
type)
in the MibOperations class should be called
before loading the MIBs. Otherwise java.sql.SQLException is thrown.
Instructions to use MySql database for loading MIBs
The following database parameters are to be configured in the application.
driver name - org.gjt.mm.mysql.Driver
url - JDBC: mysql://<machine name>/<database name>
username - <a valid user name>
password - <password for the user>
The jar file mysql_comp.jar is to be included in the CLASSPATH. If the jar is not in the CLASSPATH, the following exception is thrown.
|
Java.lang.ClassNotFoundException org.gjt.mm.mysql.Driver |
Instructions to use Oracle database for loading MIBs
The following database parameters are to be configured in the application.
driver name - org.jdbc.driver.OracleDriver
url - JDBC:oracle:thin:@<machine name>:1521:<database name>
username - <a valid user name>
password - <password for the user>
The oracle driver is to be included in the CLASSPATH. If the jar is not in the CLASSPATH, the following exception is thrown.
|
Java.lang.ClassNotFoundException oracle.jdbc.driver.OracleDriver |
For other databases, use the equivalent parameters.
|