Sha256: 035eea64353439a3dfa886d9b5f4195f1c07b5e23ed0e404c042ba6949778de5
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
package org.embulk.output.sqlserver; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import org.embulk.output.jdbc.JdbcOutputConnector; 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) { try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (Exception ex) { throw new RuntimeException(ex); } 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
6 entries across 6 versions & 1 rubygems