File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 33130

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[ ]
jQuery in Action, 3rd edition