read from pipline database BINARY object and convert it to String

Hi
I am reading in SQL Adapter service BINARY data from database and need to convert to String. How do I get it from the Pipeline? In my SQL Adapter the database value is defined as follwo:
Outpu JDBC Type : Binary
Output Field Type : byte array
and I ttried in JAVA service followings:

option1
Byte[] bytesData = (Byte[]) IDataUtil.getObjectArray(mycursor, “MyBinaryData”)

option2
String mySTring= IDataUtil.getString(aResult, “MyBinaryData”);
But no of them return correct data
?

Regarding option1 which I think is the right way, is trying to get it as objectArray the right way?
I tried following but does not work:

byte[] b2 = new byte[bytesData.length];
String mydataString = new String(b2);
System.out.println(mydataString );
Thanks for any help

Try using the charset used by database

String(byte[] bytes, Charset charset)
Constructs a new String by decoding the specified array of bytes using the specified charset.

I used the cast fuction in select statement to cast this binary value to char and it works:
CAST(MyElement as char(20) ) as MyElement
thanks