Class RCData


  • public class RCData
    extends java.lang.Object
    All the info we need to connect up to a database.
    Author:
    Blaine Simpson unsaved@users
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_JDBC_DRIVER  
    • Constructor Summary

      Constructors 
      Constructor Description
      RCData​(java.io.File file, java.lang.String dbKey)
      Creates a RCDataObject by looking up the given key in the given authentication file.
      RCData​(java.lang.String id, java.lang.String url, java.lang.String username, java.lang.String password, java.lang.String driver, java.lang.String charset, java.lang.String truststore)
      Convenience constructor for backward compatibility.
      RCData​(java.lang.String id, java.lang.String url, java.lang.String username, java.lang.String password, java.lang.String driver, java.lang.String charset, java.lang.String truststore, java.lang.String libpath)
      Creates a new RCData object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String expandSysPropVars​(java.lang.String inString)  
      java.sql.Connection getConnection()
      Gets a JDBC Connection using the data of this RCData object.
      java.sql.Connection getConnection​(java.lang.String curDriver, java.lang.String curCharset, java.lang.String curTrustStore)
      Gets a JDBC Connection using the data of this RCData object with specified override elements
      java.lang.String getDefaultJdbcDriverName()  
      void report()
      Just for testing and debugging.
      void setDefaultJdbcDriver​(java.lang.String defaultJdbcDriverName)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_JDBC_DRIVER

        public static final java.lang.String DEFAULT_JDBC_DRIVER
        See Also:
        Constant Field Values
    • Constructor Detail

      • RCData

        public RCData​(java.io.File file,
                      java.lang.String dbKey)
               throws java.lang.Exception
        Creates a RCDataObject by looking up the given key in the given authentication file.
        Parameters:
        dbKey - Key to look up in the file.
        file - File containing the authentication information.
        Throws:
        java.lang.Exception
      • RCData

        public RCData​(java.lang.String id,
                      java.lang.String url,
                      java.lang.String username,
                      java.lang.String password,
                      java.lang.String driver,
                      java.lang.String charset,
                      java.lang.String truststore)
               throws java.lang.Exception
        Convenience constructor for backward compatibility.
        Throws:
        java.lang.Exception
        See Also:
        RCData(String,String,String,String,String,String,String,String)
      • RCData

        public RCData​(java.lang.String id,
                      java.lang.String url,
                      java.lang.String username,
                      java.lang.String password,
                      java.lang.String driver,
                      java.lang.String charset,
                      java.lang.String truststore,
                      java.lang.String libpath)
               throws java.lang.Exception

        Creates a new RCData object.

        The parameters driver, charset, truststore, and libpath are optional. Setting these parameters to NULL will set them to their default values.

        Parameters:
        id - The identifier for these connection settings
        url - The URL of the database to connect to
        username - The username to log in as
        password - The password of the username
        driver - The JDBC driver to use
        charset - The character set to use
        truststore - The trust store to use
        libpath - The JDBC library to add to CLASSPATH
        Throws:
        java.lang.Exception - if the a non-optional parameter is set to NULL
    • Method Detail

      • setDefaultJdbcDriver

        public void setDefaultJdbcDriver​(java.lang.String defaultJdbcDriverName)
      • getDefaultJdbcDriverName

        public java.lang.String getDefaultJdbcDriverName()
      • report

        public void report()
        Just for testing and debugging. N.b. this echoes passwords!
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.lang.ClassNotFoundException,
                                                 java.lang.InstantiationException,
                                                 java.lang.IllegalAccessException,
                                                 java.sql.SQLException,
                                                 java.net.MalformedURLException
        Gets a JDBC Connection using the data of this RCData object.
        Returns:
        New JDBC Connection
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.sql.SQLException
        java.net.MalformedURLException
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String curDriver,
                                                 java.lang.String curCharset,
                                                 java.lang.String curTrustStore)
                                          throws java.lang.ClassNotFoundException,
                                                 java.lang.InstantiationException,
                                                 java.lang.IllegalAccessException,
                                                 java.net.MalformedURLException,
                                                 java.sql.SQLException
        Gets a JDBC Connection using the data of this RCData object with specified override elements
        Returns:
        New JDBC Connection
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.net.MalformedURLException
        java.sql.SQLException
      • expandSysPropVars

        public static java.lang.String expandSysPropVars​(java.lang.String inString)