This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes How to pick up data in mysql with Java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to pick up data in mysql with Java ?" Watch "How to pick up data in mysql with Java ?" New topic
Author

How to pick up data in mysql with Java ?

Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

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

Joined: Jan 03, 2004
Posts: 6109
    
    6

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

Joined: Jul 03, 2011
Posts: 688

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


  • The Only way to learn is ...........do!
    Visit my blog http://inaved-momin.blogspot.com/
    Gustavo Siqueira
    Ranch Hand

    Joined: Jun 15, 2011
    Posts: 97


    Problem was solved!


     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How to pick up data in mysql with Java ?
     
    Similar Threads
    hibernate.cfg.xml not found
    change the icon of .jar file
    This weeks Giveaway
    tomcat and db connectivity
    HOW TO PICK UP DATA FROM AN HTML TABLE CELL/COLUMN