Interface ConnectionFactory

  • All Known Implementing Classes:
    ConnectionFactoryImpl

    public interface ConnectionFactory
    Version:
    0.1
    Author:
    Craig Russell
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Connection getConnection()
      Returns java.sql.Connection
      String getDriverName()
      Returns JDBC driver name
      int getLoginTimeout()
      Returns the number of seconds to wait for a new connection to be established to the data source
      PrintWriter getLogWriter()
      Returns the LogWriter to which messages should be sent
      int getMaxPool()
      Returns maximum number of connections in the connection pool
      int getMinPool()
      Returns minimum number of connections in the connection pool
      int getMsInterval()
      Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.
      int getMsWait()
      Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exception
      int getTransactionIsolation()
      Returns current transaction isolation level for connections of this ConnectionFactory.
      String getURL()
      Returns connection URL
      String getUserName()
      Returns database user name
      void setDriverName​(String driverName)
      Sets JDBC driver name
      void setLoginTimeout​(int loginTimeout)
      Sets the number of seconds to wait for a new connection to be established to the data source
      void setLogWriter​(PrintWriter logWriter)
      Sets the LogWriter to which messages should be sent
      void setMaxPool​(int maxPool)
      Sets maximum number of connections in the connection pool
      void setMinPool​(int minPool)
      Sets minimum number of connections in the connection pool
      void setMsInterval​(int msInterval)
      Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.
      void setMsWait​(int msWait)
      Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exception
      void setPassword​(char[] password)
      Sets database user password
      void setTransactionIsolation​(int level)
      Sets transaction isolation level for all connections of this ConnectionFactory.
      void setURL​(String URL)
      Sets JDBC connection URL
      void setUserName​(String userName)
      Sets database user
    • Method Detail

      • getConnection

        Connection getConnection()
        Returns java.sql.Connection
        Returns:
        connection as java.sql.Connection
      • setDriverName

        void setDriverName​(String driverName)
        Sets JDBC driver name
        Parameters:
        driverName - JDBC driver name
      • getDriverName

        String getDriverName()
        Returns JDBC driver name
        Returns:
        driver name
      • setURL

        void setURL​(String URL)
        Sets JDBC connection URL
        Parameters:
        URL - connection URL
      • getURL

        String getURL()
        Returns connection URL
        Returns:
        connection URL
      • setUserName

        void setUserName​(String userName)
        Sets database user
        Parameters:
        userName - database user
      • getUserName

        String getUserName()
        Returns database user name
        Returns:
        current database user name
      • setPassword

        void setPassword​(char[] password)
        Sets database user password
        Parameters:
        password - database user password
      • setMinPool

        void setMinPool​(int minPool)
        Sets minimum number of connections in the connection pool
        Parameters:
        minPool - minimum number of connections
      • getMinPool

        int getMinPool()
        Returns minimum number of connections in the connection pool
        Returns:
        connection minPool
      • setMaxPool

        void setMaxPool​(int maxPool)
        Sets maximum number of connections in the connection pool
        Parameters:
        maxPool - maximum number of connections
      • getMaxPool

        int getMaxPool()
        Returns maximum number of connections in the connection pool
        Returns:
        connection maxPool
      • setMsInterval

        void setMsInterval​(int msInterval)
        Sets the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.
        Parameters:
        msInterval - the interval between attempts to get a database connection, in milliseconds.
      • getMsInterval

        int getMsInterval()
        Returns the amount of time, in milliseconds, between the connection manager's attempts to get a pooled connection.
        Returns:
        the length of the interval between tries in milliseconds
      • setMsWait

        void setMsWait​(int msWait)
        Sets the number of milliseconds to wait for an available connection from the connection pool before throwing an exception
        Parameters:
        msWait - number in milliseconds
      • getMsWait

        int getMsWait()
        Returns the number of milliseconds to wait for an available connection from the connection pool before throwing an exception
        Returns:
        number in milliseconds
      • setLogWriter

        void setLogWriter​(PrintWriter logWriter)
        Sets the LogWriter to which messages should be sent
        Parameters:
        logWriter -
      • getLogWriter

        PrintWriter getLogWriter()
        Returns the LogWriter to which messages should be sent
        Returns:
        logWriter
      • setLoginTimeout

        void setLoginTimeout​(int loginTimeout)
        Sets the number of seconds to wait for a new connection to be established to the data source
        Parameters:
        loginTimeout - wait time in seconds
      • getLoginTimeout

        int getLoginTimeout()
        Returns the number of seconds to wait for a new connection to be established to the data source
        Returns:
        wait time in seconds
      • setTransactionIsolation

        void setTransactionIsolation​(int level)
        Sets transaction isolation level for all connections of this ConnectionFactory. All validation is done by java.sql.Connection itself, so e.g. while Oracle will not allow to set solation level to TRANSACTION_REPEATABLE_READ, this method does not have any explicit restrictions
        Parameters:
        level - - one of the java.sql.Connection.TRANSACTION_* isolation values
      • getTransactionIsolation

        int getTransactionIsolation()
        Returns current transaction isolation level for connections of this ConnectionFactory.
        Returns:
        the current transaction isolation mode value as java.sql.Connection.TRANSACTION_*