public Connection obtainConnection()

in dekaf-jdbc/src/impl/JdbcFacade.java [150:171]


    public Connection obtainConnection(final @Nullable String connectionString,
                                       final @Nullable Settings connectionParameters) {
        String cs = connectionString != null ? connectionString : this.jdbcConnectionString;
        Settings ps = connectionParameters != null ? connectionParameters : this.jdbcParameters;

        Connection connection;
        try {
            if (connectionString != null) {
                if (!driver.acceptsURL(connectionString))
                    throw new DBDriverException("Jdbc Driver doesn't accept this connection string: " + connectionString);
            }
            Properties props = ps != null ? ps.toProperties() : new Properties();
            connection = driver.connect(cs, props);
        }
        catch (SQLException sqle) {
            throw new DBDriverException("Failed to connect: " + sqle.getMessage(), sqle);
        }
        catch (Exception e) {
            throw new DBDriverException("Failed to connect: " + e.getMessage(), e);
        }
        return connection;
    }