This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pick up data in mysql with Java ?

 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I need pick up values in mysql. For example:



If the value that the user typed == the value of tables of mysql.
How to do this ?

Thanks you!
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you need to forget about any connection to the GUI or to comparing things.

1. On the one hand, you get data from a DB.

2. On another, totally independent hand, you extract a value from a GUI element.

3. On yet another, totally independent and unrelated hand, you compare strings.

Note that these are all totally unrelated to each other. The way you fetch from a DB is the same regardless of whether your app has a GUI and regardless of what you're going to do with the String, such as compare it. The way you compare Strings is completely independent of where the Strings come from.

So, don't ask "How do I compare a String from the DB with a String in the GUI?" Instead, narrow your question down and focus on which of #1, #2, or #3 you're currently having trouble with. Since you seem to be asking about interacting with a DB, I will point you toward googling for JDBC tutorial.
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gustavo Hackum wrote:Hello!
I need pick up values in mysql. For example:



If the value that the user typed == the value of tables of mysql.
How to do this ?

Thanks you!

yes, i agree with jeff , as far as your question is consider you have to do this thing
  • write a SQL quarry with statement or preparedstatement
  • execute that Quarry and get the resultset
  • now fetch the data from the resultSet
  • then compare the data you have got from the resultSet with your String using equals for object and "==" for primitives like int , chars etc..hope this helps
  •  
    Gustavo Siqueira
    Ranch Hand
    Posts: 97
    C++ Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Problem was solved!


     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic