Sha256: 941f4d3d2417f12c391eb9f8380a48afff4adb8c8850622879248a40c13e464a

Contents?: true

Size: 1.19 KB

Versions: 11

Compression:

Stored size: 1.19 KB

Contents

package org.embulk.output.sqlserver;

import org.embulk.output.jdbc.JdbcOutputConnector;

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

public class SQLServerOutputConnector
        implements JdbcOutputConnector
{
    private final String url;
    private final Properties properties;
    private final String schemaName;

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

    @Override
    public SQLServerOutputConnection 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 {
            SQLServerOutputConnection con = new SQLServerOutputConnection(c, schemaName, autoCommit);
            c = null;
            return con;

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
embulk-output-sqlserver-0.7.8 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.7 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.6 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.5 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.4 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.3 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.2 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.1 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.7.0 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.6.5 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java
embulk-output-sqlserver-0.6.4 src/main/java/org/embulk/output/sqlserver/SQLServerOutputConnector.java