I’m fed up researching this and figure it ought to have a simple answer, so here goes… I’m working in Java with JDBC and various databases (Oracle, SqlServer, and DB2, although I’m trying to get Oracle working first). In my Java program, I start with a String value and encrypt it into a primitive byte array (byte). Now how do I store and retrieve that from the database?
I had it working with varchar2 datatype, but now that I’m doing a more thorough test, it is not accepting certain values. It’s saying ORA-00911 invalid character.
byte array = …;
“insert into… values (’” + new String(array) + "’…
was working OK. But now it seems there’s a character set problem. I’ve tried using RAW datatype but that’s no help. Also tried specifying as hex (0x), using varchar2(char), etc.
So I’m getting a headache and if anyone out there has an idea about this, I’d love to hear it.