Class DBTools


  • public abstract class DBTools
    extends Object
    This class is intended to be group some utility classes related with RDBMS and the capsd and monitoring plugins.
    Since:
    0.1
    Version:
    0.1 - 07/22/2002
    Author:
    Jose Vicente Nunez Zuleta (josevnz@users.sourceforge.net) - RHCE, SJCD, SJCP
    • Field Detail

      • MIN_PORT_VALUE

        public static final int MIN_PORT_VALUE
        Minimal port range
        See Also:
        Constant Field Values
      • MAX_PORT_VALUE

        public static final int MAX_PORT_VALUE
        Maximum port range
        See Also:
        Constant Field Values
      • DEFAULT_JDBC_DRIVER

        public static final String DEFAULT_JDBC_DRIVER
        Default Sybase JDBC driver to use. Defaults to 'com.sybase.jdbc2.jdbc.SybDriver'
        See Also:
        Constant Field Values
      • DEFAULT_DATABASE_USER

        public static final String DEFAULT_DATABASE_USER
        Default user to use when connecting to the database. Defaults to 'sa'
        See Also:
        Constant Field Values
      • DEFAULT_DATABASE_PASSWORD

        public static final String DEFAULT_DATABASE_PASSWORD
        Default database password. Should be empty. You should not put a database password here (or event worst, hardcode it in the code) Instead call the class method that accepts a map
        See Also:
        Constant Field Values
    • Constructor Detail

      • DBTools

        public DBTools()
    • Method Detail

      • constructUrl

        public static String constructUrl​(String url_,
                                          String hostname_)
                                   throws IllegalArgumentException,
                                          NullPointerException
        Constructs a JDBC url given a set of fragments. The resulting Url will have the form:
        jdbc:<protocol>:hostname:4100
        Parameters:
        hostname_ - The hostname where the database server is
        url_ - (for example jdbc:sybase:Tds:@{link #OPENNMS_JDBC_HOSTNAME OPENNMS_JDBC_HOSTNAME}:4100/tempdb). The OPENNMS_JDBC_HOSTNAME is replaced by the real hostname
        Returns:
        a String object.
        Throws:
        NullPointerException - If one of the arguments is null
        IllegalArgumentException - If the OPENNMS_JDBC_HOSTNAME is not part of the JDBC url