src/main/java/org/embulk/output/oracle/OracleOutputConnection.java in embulk-output-oracle-0.5.0 vs src/main/java/org/embulk/output/oracle/OracleOutputConnection.java in embulk-output-oracle-0.5.1
- old
+ new
@@ -30,14 +30,14 @@
private final boolean direct;
private OracleCharset charset;
private OracleCharset nationalCharset;
- public OracleOutputConnection(Connection connection, boolean autoCommit, boolean direct)
+ public OracleOutputConnection(Connection connection, String schemaName, boolean autoCommit, boolean direct)
throws SQLException
{
- super(connection, getSchema(connection));
+ super(connection, schemaName == null ? getSchema(connection) : schemaName);
connection.setAutoCommit(autoCommit);
this.direct = direct;
}
@@ -52,10 +52,13 @@
}
}
@Override
protected void setSearchPath(String schema) throws SQLException {
- // NOP
+ if (!getSchema(connection).equals(schema)) {
+ // Because old Oracle JDBC drivers don't support Connection#setSchema method.
+ connection.setSchema(schema);
+ }
}
@Override
public void dropTableIfExists(String tableName) throws SQLException
{