src/main/java/org/embulk/output/oracle/oci/OCIWrapper.java in embulk-output-oracle-0.5.0 vs src/main/java/org/embulk/output/oracle/oci/OCIWrapper.java in embulk-output-oracle-0.5.1

- old
+ new

@@ -129,10 +129,21 @@ public void prepareLoad(TableDefinition tableDefinition) throws SQLException { this.tableDefinition = tableDefinition; + if (tableDefinition.getSchemaName() != null) { + Pointer schemaName = createPointer(tableDefinition.getSchemaName()); + check("OCIAttrSet(OCI_ATTR_NAME)", oci.OCIAttrSet( + dpHandle, + OCI.OCI_HTYPE_DIRPATH_CTX, + schemaName, + (int)schemaName.size() + , OCI.OCI_ATTR_SCHEMA_NAME, + errHandle)); + } + // load table name Pointer tableName = createPointer(tableDefinition.getTableName()); check("OCIAttrSet(OCI_ATTR_NAME)", oci.OCIAttrSet( dpHandle, OCI.OCI_HTYPE_DIRPATH_CTX, @@ -396,10 +407,11 @@ return new ArrayMemoryIO(Runtime.getSystemRuntime(), com.kenai.jffi.Type.POINTER.size()); } private Pointer createPointer(String s) { - return Pointer.wrap(Runtime.getSystemRuntime(), ByteBuffer.wrap(s.getBytes())); + // not database charset, but system charset of client + return Pointer.wrap(Runtime.getSystemRuntime(), ByteBuffer.wrap(s.getBytes(systemCharset))); } private Pointer createPointer(short n) { Pointer pointer = new ArrayMemoryIO(Runtime.getSystemRuntime(), 2);