I am using DatabaseWriterFilterAdapter for trnasfomation of colums which contain xml as text to Bytea for traget database.
In oracle source db value is in txt format .
I zip the value and convert to bytea format and sent to postgres bytea colum
Since the parsedData is of string type , I am not able set bytea value for target column.
Even I have to do vice-versa.
Can you please suggest , Is I am doing in right approach or any other way to handle this scenario.
Thanks,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI
I am Using symds verssion 3.11
I have source DB oracle and target db postgressql
I am using DatabaseWriterFilterAdapter for trnasfomation of colums which contain xml as text to Bytea for traget database.
In oracle source db value is in txt format .
I zip the value and convert to bytea format and sent to postgres bytea colum
below isthe sample code.
public void beforeWrite(DataContext context, Table table, CsvData data) {
string [] parsedData = data.getParsedData(CsvData.ROW_DATA)
string text = parsedData { table.getColumnIndex("LARGE_TEXT");
byte[] zipbytea= zip( string text) // java zip compression
parsedData { table.getColumnIndex("BYTEA_DATA") = zipbytea; // update in postgres bytea column
}
Since the parsedData is of string type , I am not able set bytea value for target column.
Even I have to do vice-versa.
Can you please suggest , Is I am doing in right approach or any other way to handle this scenario.
Thanks,
To get sent to Postgres, it would need to be base 64 encoded. You could use the following:
java.util.Base64.getEncoder().encodeToString(zipbytea)
Thank you