storing binary infomration in a Unicodestring

what is the best way, if any, to store binary information in a rad studio unicodestring? I intend to transfer this to the database to a Oracle Varchar2 field.
UnicodeString sprint;
	sprint.SetLength(2000);

   for(int i=0;i<pBlob->cbData ;i++)
   {
	   //pBlob->pbData[i] = bdata[i];
	   cout<<pBlob->pbData[i];
	   sprint[i+1]=pBlob->pbData[i];
   }

Open in new window

LVL 1
ol muserTechnology GeneralistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grishavCommented:
I'd use some encoding. Try to google for base64, for example.
sarabandeCommented:
the UnicodeString has a constructor that takes an arbitrary (so also with binary data) buffer:

UnicodeString (UChar *buffer, int32_t buffLength, int32_t buffCapacity)

Open in new window


however i don't see a benefit using the UnicodeString and would suggest for a std::vector instead:

std::vector<unsigned char> buffer;

Open in new window


in the oracle you can't store a blob with binary data to varchar2. beside of the maximum length of 4000 the varchar2 would assume single-byte charset. for unicode string use nvarchar2. for blob data use long or long raw datataype if only one blob field in table. otherwise use blob datatype.

Sara

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.