Results 1 to 3 of 3
  1. #1
    Candesco is offline Member
    Join Date
    Dec 2010
    Posts
    16
    Rep Power
    0

    Default Mysql Error Password Field

    Hello there,

    I have a question, i have made a database table for my java chat application.
    Everything works great, but for some reason, if a user register his nickname with a password
    it will be stored into my database, but once i re-login i am not able to login with the password i set?

    Java Code:
    CREATE TABLE IF NOT EXISTS `user` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` text NOT NULL,
      `password` text NOT NULL,
      `roleid` int(11) NOT NULL,
      `roleby` text NOT NULL,
      `age` text NOT NULL,
      `gender` text NOT NULL,
      `city` text NOT NULL,
      `homepage` text NOT NULL,
      `extra` text NOT NULL,
      `email` text NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
    
    --
    -- Dumping data for table `user`
    --
    
    INSERT INTO `user` (`id`, `name`, `password`, `roleid`, `roleby`, `age`, `gender`, `city`, `homepage`, `extra`, `email`) VALUES
    (2, 'michael', 'test', 3, 'Server', '', '', '', '', '', 'test'),
    (3, 'tester', 'test', 2, 'Server', '', '', '', '', '', '123');
    can somebody please fix this?

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default Re: Mysql Error Password Field

    According to your table definition, the INSERT statement should fail because you are attempting to add NULL values to fields which are set to NOT NULL.

    The data probably isn't being inserted.

    Also, for security reasons, you should look into parametrized inserts and salt & hashing the password rather than storing it as plain text.

  3. #3
    UJJAL DHAR is offline Senior Member
    Join Date
    Apr 2010
    Location
    Dhaka,Bangladesh
    Posts
    180
    Rep Power
    0

    Default Re: Mysql Error Password Field

    Are you sure about the syntax of inserting?
    Java Code:
    INSERT INTO tableneme (col1,col2,....) values (val1,val2,...)
    And,you can not insert a null value where you have set a constraint as not null.
    Don't Forget to try yourself before asking others help.....
    Press REP, if you find their advices/solutions effective.

Similar Threads

  1. Password field dont work!
    By Rasmase in forum New To Java
    Replies: 5
    Last Post: 10-07-2011, 06:22 PM
  2. Replies: 4
    Last Post: 08-01-2011, 11:29 AM
  3. password Field String
    By mudassir07 in forum NetBeans
    Replies: 1
    Last Post: 02-19-2011, 09:18 AM
  4. Replies: 12
    Last Post: 04-18-2009, 01:58 AM
  5. How to check password of a jsp/html with the password of Database(mysql) #1
    By sk.mahaboobbhasha@gmail.c in forum Java Servlet
    Replies: 2
    Last Post: 11-14-2008, 02:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •