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 Storing Passwords in MySQL 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 "Storing Passwords in MySQL" Watch "Storing Passwords in MySQL" New topic

Storing Passwords in MySQL

Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
Hi friends,

I am new to all this Database stuff...

I am learning them , only because i wanna incorporate some persistent story to my web app...

Can some one tell how i could store the passwords in a way it is unreadable to naked eye..

1)through DBMS--MySQL
2)or programmatically

Theepan Thevathasan
SCJP 1.4, SCWCD 1.4, SCMAD 1.0 SCBCD 1.3, MCP(.Net Frm 2.0 App Dev Fdn)
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148
Originally posted by Theepan Thevathasan:

1)through DBMS--MySQL
2)or programmatically[/QB]

Either approach is fine. 2) is probably a better solution regarding to portability.
Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
sorry i was my mistake, that i didnt ask why ...

can some give some code /procedures for the two options...

thanks in advance
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

This seems to be a way to do number 1 (Caveat - I don't know MySQL that well, so there is in all probablility a different/better way to do this).

My preference would be to do this programatically round some sort of hashing standard (such as MD5). This way your application is database indenendent, and it allows other applications that can implement a digest using this standard a route to validate passwords based on the database values. Have a look at the classes available to you in the package.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Storing Passwords in MySQL
It's not a secret anymore!