File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Problem while retrieving values from table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem while retrieving values from table" Watch "Problem while retrieving values from table" New topic
Author

Problem while retrieving values from table

Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
I am storing password in encrypted form in mysql. Now when the user logsin back, I am retrieving those values from the table and comparing those values with the encrypted value of the password of the user who is trying to login but the problem is that I am getting different values from my tables.

I have used rs.getString ("password")
where password is the field name.

This value is in the table
���7�����]�����7vg�
But the retrieved value is
???7???]???7vg?

Why is it so?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Because the database is probably using a different character encoding than your Java application. If your encrypted password contains non-text characters, you shouldn't store it in a text-oriented column type (such as VARCHAR) - use a binary column type instead, or convert it to text, for example using Base64 encoding.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Please do not post your question in more than one forum.
You also posted this in the Advanced forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while retrieving values from table
 
Similar Threads
Sample program for logon authentication
Problem while retrieving values from table
Need Help in Encryption
ActionContext and Session Objects
JSP/Oracle Authentication