• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem while retrieving values from table

 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post your question in more than one forum.
You also posted this in the Advanced forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic