Sha256: 8c5d8519a51dd1ac6a7410d23658c1a49dd898e9b551a5ee7398e36a340b0390
Contents?: true
Size: 1.31 KB
Versions: 17
Compression:
Stored size: 1.31 KB
Contents
package org.embulk.output.db2; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import org.embulk.output.jdbc.JdbcOutputConnector; public class DB2OutputConnector implements JdbcOutputConnector { private final String url; private final Properties properties; private final String schemaName; public DB2OutputConnector(String url, Properties properties, String schemaName) { try { Class.forName("com.ibm.db2.jcc.DB2Driver"); } catch (Exception ex) { throw new RuntimeException(ex); } this.url = url; this.properties = properties; this.schemaName = schemaName; } @Override public DB2OutputConnection 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 { DB2OutputConnection con = new DB2OutputConnection(c, schemaName, autoCommit); c = null; return con; } finally { if (c != null) { c.close(); } } } }
Version data entries
17 entries across 17 versions & 1 rubygems