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 Problem in SQL (MySQL) select password column 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 "Problem in SQL (MySQL) select password column " Watch "Problem in SQL (MySQL) select password column " New topic

Problem in SQL (MySQL) select password column

Ken Shamrock
Ranch Hand

Joined: Jan 23, 2002
Posts: 139
I created a password column using
Insert into table (password) values (PASSWORD(abc))
and ok,
but I can't select it back using
Select * from table where password="PASSWORD(abc)"
Or Select * from table where password=(Select PASSWORD(abc));
Empty set returned,why?
**I can only do it this way
1) Select PASSWORD(abc); get the encoded password
2) then Select * from table where password="Encoded String";
but I don't want to do in this indirect way

Thanks everyone who helped me
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

I've had the same problem. Can I guess that you're not running *nux and are in Windows instead?
If you search the MySQL docs, the password function is supported by the crypt() system call. This doesn't exist in Windows. I had a search and I think there are implementations you can plug in, but I never bothered...
Is this the problem you are having?
Ken Shamrock
Ranch Hand

Joined: Jan 23, 2002
Posts: 139
Thanks for reply. Yes I m using WinXP.
I've figured out the reason why now. The password column should be exceeds 16 char, otherwise its not enough to stored the encoded string. Now it's ok
I agree. Here's the link:
subject: Problem in SQL (MySQL) select password column
It's not a secret anymore!