Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

char to binary

 
roy ramos
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i have problem updating char to binary, is like when i enter 123 it save on the database like this 100000000200000000300000000
below is the code





thanks
-roy
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roy,

Why don't you try using executeUpdate instead of executeQuery.

Regards,

Fatih.

Edit: Typo corrected
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roy,

can you please share what is (not) happening, and the error codes you get?

(by the way, storing passwords as a binary value is not a strong security measure. It is way too easy to revert. It is virtualy the same as just storing the plain text string.)

Regards, Jan
 
roy ramos
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Fatih,

thanks for suggestion will try that

Hi Jan,

Im expecting that the binary will be saved like 123000000000000, no error codes, what do you suggest on how to store the password, im still newbie on programming

thanks,
-roy
 
Priya dharshini
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use any one of encoding techniques like base64 encoding
 
roy ramos
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya dharshini wrote:you can use any one of encoding techniques like base64 encoding


hi Priya,

if the password is already encrypt using md5 and saved in the database, during login how can i compare if it's same with the user entered password with the data that was encrypt in md5 ? can anybody show me a sample code during user login

thanks,
-roy
 
Smitesh Shinde
Ranch Hand
Posts: 45
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Encrypt the password entered by user same way and compare it with one saved in daabase.Or decrypt the password from database and compare it with the one user entered.
 
roy ramos
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Smitesh Shinde wrote:Encrypt the password entered by user same way and compare it with one saved in daabase.Or decrypt the password from database and compare it with the one user entered.


Thanks Smitesh got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic