Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm looking for something similar to:

utl_smtp.command(conn, utl_encode.base64_encode(utl_raw.cast_to_raw(<username>)));

I couldn't find any reference among the DB2's system-defined modules and I've read that:

after migrating to DB2 there is a little surprise - there is nothing like UTL_RAW and UTL_ENCODE functions

that was written on March 28, 2010.

Considering that DB2's Oracle compatibility has increased with every release from v9, do the newer versions of DB2 provide any equivalents for Oracle's UTL_ENCODE and UTL_RAW?

share|improve this question

1 Answer 1

I believe you are correct. It does not look like DB2 has built in support for base64 encoding.

So that would leave the following as options:

  1. Handle the encoding within your programs.
  2. Write a Java routine (stored procedure) to handle it.
  3. Using a different encryption scheme. DB2 comes with encryption built into itself. There is an ENCRYPT function. Check it out.

Be careful with Java implementations of base64 though. A coworker of mine has mentioned he has seen a bug in all versions of it, in which "words" that have duplicate letters can decrypt into junk. So be careful and double check your base64 encoding/decoding.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.