Menu

In symds extension code , error while send zip byte array data to destination

2024-06-20
2024-07-08
  • Susant Mohapatra

    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,

     
  • Catherine Quamme

    To get sent to Postgres, it would need to be base 64 encoded. You could use the following:

    java.util.Base64.getEncoder().encodeToString(zipbytea)

     
  • Susant Mohapatra

    Thank you

     

Log in to post a comment.