Results 1 to 3 of 3
  1. #1
    StalaK is offline Member
    Join Date
    May 2011
    Rep Power

    Default Can't seem to get a count(*) where query working

    I'm kind of new to this and I'm trying to check the existence of a record in my database using count(*).

    In MySQL the query is simply SELECT COUNT(*) FROM user WHERE username = 'name'; where 'name' is a variable set by the user's input, I just can't seem to find out how to get the result of the query stored in an integer variable. If anyone could help that would be great.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    uhm int whatever = resultset.getInt(1), maybe?

    See the JDBC tutorials.

  3. #3
    Join Date
    Mar 2010
    Rep Power

Similar Threads

  1. Count down
    By tj_wolf2 in forum New To Java
    Replies: 8
    Last Post: 03-14-2011, 06:07 PM
  2. Replies: 2
    Last Post: 01-04-2011, 05:30 AM
  3. to get count value as a variable
    By arunkumarinfo in forum JDBC
    Replies: 2
    Last Post: 03-30-2009, 02:32 AM
  4. Replies: 8
    Last Post: 05-28-2008, 08:00 AM
  5. Getting row count
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-11-2008, 09:49 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