aspose file tools*
The moose likes JDBC and the fly likes char to binary Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "char to binary" Watch "char to binary" New topic
Author

char to binary

roy ramos
Greenhorn

Joined: Nov 17, 2009
Posts: 26
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


-roy
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Roy,

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

Regards,

Fatih.

Edit: Typo corrected
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

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


OCUP UML fundamental and ITIL foundation
youtube channel
roy ramos
Greenhorn

Joined: Nov 17, 2009
Posts: 26
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

Joined: Aug 06, 2005
Posts: 78
you can use any one of encoding techniques like base64 encoding


Thanks & Regards,
Priyadharshini . T
roy ramos
Greenhorn

Joined: Nov 17, 2009
Posts: 26
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

Joined: Feb 16, 2008
Posts: 45

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

Joined: Nov 17, 2009
Posts: 26
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: char to binary