This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes column type to save byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "column type to save byte array" Watch "column type to save byte array" New topic

column type to save byte array

Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
Hi All,
I'm having problems saving and retrieving byte arrays in my logon bean from the database, which is mySQL and sometimes Oracle.
I'm hashing a password and saving it and a salt, both as byte arrays, into varchar fields in the database. When I retrieve them, they have changed.
Should I use a different column data type?
While debugging it, I checked to make sure that at least in Java, if I convert a byte array to a string and back to a byte array again, it remains the same.
Thanks in advance for any help!


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
I'm still flummoxed by this. Does anybody have any advice please?
I've been looking at blob type fields, but they seem to be totally over the top and use extra resources.
All I want is a field to reliably save the output from my String.toBytes() function.
Have you checked out Aspose?
subject: column type to save byte array
jQuery in Action, 3rd edition