Results 1 to 3 of 3
  1. #1
    rdbll is offline Member
    Join Date
    Feb 2014
    Posts
    1
    Rep Power
    0

    Default Textfield lowercase and uppercase

    hi

    String sql = "SELECT * FROM user WHERE username =? and password =?" ;
    pst = conn.prepareStatement(sql);
    pst.setString(1, username.getText());
    pst.setString(2, password.getText());
    rs = pst.executeQuery();
    if(rs.next()){
    do somethig;
    {

    i have 2 textfield that take username and password,
    on the database thete is a user table
    id username password name surname
    1 test test test test


    people put username and password to the textfield like test test and they logon,
    but when they write username = TESt and password = teST they can logon too,

    there is no TESt user on the database or teST password, is the textfield making lowercase all text? how can i fix this?

    or pst.setString(1, username.getText()); is this code changing the text?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default Re: Textfield lowercase and uppercase

    A JTextField doesn't change the case of its text; there must be something in your database that ignores the case of the text ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: Textfield lowercase and uppercase

    Quote Originally Posted by JosAH View Post
    A JTextField doesn't change the case of its text; there must be something in your database that ignores the case of the text ...
    Pretty much default behavior of for example MySQL.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. How to lowercase all arguments
    By reverton in forum New To Java
    Replies: 1
    Last Post: 04-28-2013, 07:35 AM
  2. Replies: 8
    Last Post: 08-17-2011, 12:15 PM
  3. Check uppercase or lowercase letter
    By ala_mages in forum New To Java
    Replies: 2
    Last Post: 12-30-2010, 03:16 PM
  4. uppercase and lowercase please help
    By cuziwow in forum New To Java
    Replies: 4
    Last Post: 04-11-2010, 08:54 AM
  5. String uppercase/lowercase
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-19-2007, 10:22 AM

Posting Permissions

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