Sha256: ed0635ebb64ef0b992f50d3f6495aadb736baf4da2a41d8a4a465ba76a12576c

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

package org.embulk.output.postgresql;

import java.util.Properties;
import java.sql.Driver;
import java.sql.Connection;
import java.sql.SQLException;
import org.embulk.output.jdbc.JdbcOutputConnector;
import org.embulk.output.jdbc.JdbcOutputConnection;

public class PostgreSQLOutputConnector
        implements JdbcOutputConnector
{
    private static final Driver driver = new org.postgresql.Driver();

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

    public PostgreSQLOutputConnector(String url, Properties properties, String schemaName)
    {
        this.url = url;
        this.properties = properties;
        this.schemaName = schemaName;
    }

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
embulk-output-postgresql-0.4.0 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.3.0 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.2.3 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.2.2 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.2.1 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.2.0 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.1.2 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.1.1 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java
embulk-output-postgresql-0.1.0 src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnector.java