This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Saving, getting byte[ ] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Saving, getting byte[ ] " Watch "Saving, getting byte[ ] " New topic

Saving, getting byte[ ]

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Hi all.
I have MySQl server.
my database will store the username and his password.
the application will not store the password as a plain text, instead, the application will compute the digest of the password (using MessageDigest class), so the application will save the password as byte[ ] type.
my questions are :
1. what is the type of byte[ ] should be in the database ?
2. to store byte[ ] in the database we use :
and to retrieve byte[ ] we use :
right ??
thanks ranchers.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32848

1) Take a look at section 8.3.2 of Sun's document about the BINARY type.
2) Yes, your calls are correct.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Saving, getting byte[ ]
It's not a secret anymore!