Sha256: 072d56fd763054bd87b91c51f41d99cc3b0a98f5d9198c1237bad779bacf2070

Contents?: true

Size: 1.3 KB

Versions: 9

Compression:

Stored size: 1.3 KB

Contents

package org.embulk.output.oracle;

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

import org.embulk.output.jdbc.JdbcOutputConnector;

public class OracleOutputConnector
        implements JdbcOutputConnector
{
    private final String url;
    private final Properties properties;
    private final boolean direct;

    public OracleOutputConnector(String url, Properties properties, boolean direct)
    {
        try {
            Class.forName("oracle.jdbc.OracleDriver");
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        this.url = url;
        this.properties = properties;
        this.direct = direct;
    }

    @Override
    public OracleOutputConnection connect(boolean autoCommit) throws SQLException
    {
        Connection c = DriverManager.getConnection(url, properties);
        if (c == null) {
            // driver.connect returns null when url is "jdbc:mysql://...".
            throw new SQLException("Invalid url : " + url);
        }

        try {
            OracleOutputConnection con = new OracleOutputConnection(c, autoCommit, direct);
            c = null;
            return con;

        } finally {
            if (c != null) {
                c.close();
            }
        }
    }
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
embulk-output-oracle-0.5.0 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.4.5 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.4.4 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.4.3 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.4.2 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.4.0 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.3.0 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.2.3 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java
embulk-output-oracle-0.2.2 src/main/java/org/embulk/output/oracle/OracleOutputConnector.java