1. Muhammad Asim Mumtaz
  2. PowerBuilder
  3. Tuesday, 11 February 2020 05:25 AM UTC

I am working on some of features available in Appeon (PowerBuilder 2019) for upgrading from the old version. I need some information/help for the following topics

  1. Converting Blob into string
    1. I am encrypting the plain text using “SymmetricEncrypt” method which returns blob, when I convert the blob into string it returns garbage e.g. “꟫礽郼⊵ꩩ䁥鯺ꇃ”. I need to save these encrypted values in text file. Please provide some solution. Thanks. Example is also given below

      Blob blb_encrypt, blb_data
      String s_data
      lb_data = Blob(string(ls_data), EncodingANSI!)
      blb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, blb_data, blb_key,OperationModeCBC!, lblb_iv, PKCSPadding!)
      ls_data = string(lblb_encrypt,EncodingUTF16LE!)

      i need to  convert ls_data into a normal string, so that i can store it in some text file and decrypt it while connecting to DB server.
    2. s
  2. Saving the docx into Database using Blob
    1. Previously  we were using “.doc” format for documents printing using blob for both saving and fetching the templates from Database (SQL 2014). But now we need to use the “.docx” format, while loading the “docx” to blob it returns garbage value. We need to save the “docx” to Database and then use the same template for printing using PowerBuilder
Michael Kramer Accepted Answer Pending Moderation
  1. Wednesday, 12 February 2020 01:31 AM UTC
  2. PowerBuilder
  3. # 1

Re 1) Agree with René: You need to convert the encrypted value into text-compatible string. Base64 is a great option.

Re 2) DOCX in BLOB: What exactly is returning "garbage"?

  1. Read DOCX file into BLOB using FileReadEx(...)?
  2. SELECTBLOB of DOCX file already stored in database?

What datatype are you using for the column where you store documents?

I have up-to-date versions of MSSQL 2019 and MS Words so I can try out specific combo if I know what to test.

Oh - note: DOCX is actually ZIP file so content will look like garbage wehn side-by-side compared byte-for-byte with same text stored in DOC format.

There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 11 February 2020 06:20 AM UTC
  2. PowerBuilder
  3. # 2


You can't store encrypted data directly as text. To store the data you should convert it to Base64.


I'm not using SQL 2014. With Oracle I have no problem to store or fetch docx files. Maybe you are storing the data in a column with wrong datatype? Or you do some conversions?




There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.