Sha256: c4e16af4f4bde2b1320afc2e32a43776bf85a8926b9cc29681577a1491c87783

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

package org.embulk.output.redshift;

import java.util.Properties;
import java.sql.Driver;
import java.sql.Connection;
import java.sql.SQLException;

import org.embulk.output.jdbc.AbstractJdbcOutputConnector;
import org.embulk.output.jdbc.JdbcOutputConnection;
import org.embulk.output.jdbc.TransactionIsolation;

import com.google.common.base.Optional;

public class RedshiftOutputConnector
        extends AbstractJdbcOutputConnector
{
    private static final Driver driver = new org.postgresql.Driver();

    private final String url;
    private final Properties properties;
    private final String schemaName;

    public RedshiftOutputConnector(String url, Properties properties, String schemaName,
            Optional<TransactionIsolation> transactionIsolation)
    {
        super(transactionIsolation);
        this.url = url;
        this.properties = properties;
        this.schemaName = schemaName;
    }

    @Override
    protected JdbcOutputConnection connect() throws SQLException
    {
        Connection c = driver.connect(url, properties);
        try {
            RedshiftOutputConnection con = new RedshiftOutputConnection(c, schemaName);
            c = null;
            return con;
        } finally {
            if (c != null) {
                c.close();
            }
        }
    }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embulk-output-redshift-0.8.7 src/main/java/org/embulk/output/redshift/RedshiftOutputConnector.java
embulk-output-redshift-0.8.6 src/main/java/org/embulk/output/redshift/RedshiftOutputConnector.java
embulk-output-redshift-0.8.5 src/main/java/org/embulk/output/redshift/RedshiftOutputConnector.java
embulk-output-redshift-0.8.4 src/main/java/org/embulk/output/redshift/RedshiftOutputConnector.java
embulk-output-redshift-0.8.3 src/main/java/org/embulk/output/redshift/RedshiftOutputConnector.java