Interface ConnectionFactory

  • All Known Implementing Classes:
    JNDIConnectionFactory, StandaloneConnectionPool

    public interface ConnectionFactory
    Factory responsible for creating SQL Connections basis on the provided parameters. ConnectionFactory encapsulates all connection configuration details under the hood, allowing to switch between particular implementations transparently.
    Since:
    2.1.0-SNAPSHOT
    Version:
    %I%, %G%
    Author:
    Piotr Dyraga
    • Method Detail

      • getConnection

        Connection getConnection​(String name)
        Returns SQL Connection instance available under the given name (for example under JNDI name within Java EE container). If no Connection has been bound to the provided name, then DatabaseException containing root cause is thrown.
        Parameters:
        name - name to which connection is bound
        Returns:
        ready for use Connection instance bound to the given name, never null
      • getConnection

        Connection getConnection​(String driver,
                                 String url,
                                 String username,
                                 String password)
        Returns SQL Connection instance configured according to provided parameters.
        Parameters:
        driver - fully qualified name of the database driver; mandatory, must not be null
        url - JDBC connection url; mandatory, must not be null
        username - database username
        password - database password
        Returns:
        ready for use Connection instance