wood burning stoves 2.0*
The moose likes JDBC 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
Bookmark "Saving, getting byte[ ] " Watch "Saving, getting byte[ ] " New topic
Author

Saving, getting byte[ ]

Hussein Baghdadi
clojure forum advocate
Bartender

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 :
resultset.updateBytes(...);
and to retrieve byte[ ] we use :
resultset.getBytes(...);
right ??
thanks ranchers.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30768
    
156

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving, getting byte[ ]