Results 1 to 2 of 2
  1. #1
    PDXErik is offline Member
    Join Date
    Aug 2010
    Posts
    1
    Rep Power
    0

    Default MySQL JDBC query returns no response

    When it's supposed to.

    Java Code:
        try{
            PCSSafe.sql.result = PCSSafe.sql.sql_statement.executeQuery("SELECT * from pcs_config WHERE cfg_id = 1");
            if(PCSSafe.sql.sql_statement.getFetchSize() == 0){
                System.out.println("No results from config load");
            }
    
            PCSSafe.sql.result.next();
    -->     cassette[0].contents[0] = PCSSafe.sql.result.getInt("cfg_V1_1s");
            cassette[0].contents[1] = PCSSafe.sql.result.getInt("cfg_V1_2s");
            cassette[0].contents[2] = PCSSafe.sql.result.getInt("cfg_V1_5s");
            cassette[0].contents[3] = PCSSafe.sql.result.getInt("cfg_V1_10s");
            cassette[0].contents[4] = PCSSafe.sql.result.getInt("cfg_V1_20s");
            cassette[0].contents[5] = PCSSafe.sql.result.getInt("cfg_V1_50s");
            cassette[0].contents[6] = PCSSafe.sql.result.getInt("cfg_V1_100s");
            cassette[0].balance = PCSSafe.sql.result.getFloat("cfg_V1_bal");
            cassette[0].denomination = PCSSafe.sql.result.getInt("cfg_V1_denom");
            cassette[0].field = PCSSafe.sql.result.getString("cfg_V1_field");
            cassette[0].name = PCSSafe.sql.result.getString("cfg_V1_name");
    
        } catch (Exception e){
            System.out.println(e);
        }
    This does not return any results, but there is one entry in pcs_db.pcs_config and the same text copied and pasted into a mysql prompt returns the expected response. I have tested similar code on the log table and it dutifully returns data.

    In the debugger, it gets to the code at the "--->" and there, the method just stops. No errors, no exceptions, just doesn't execute.

    If someone can tell an annoyed noob where he's being a jackass, it'd be appreciated.

    Thanks,
    Annoyed Noob
    Last edited by PDXErik; 08-19-2010 at 11:24 PM.

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

    Default

    The getFetchSize() method doesn't return the number of records that were actually fetched but is an indication how many records can be fetched in one sweep. See the explanation in the API documentation for the setFetchSize(int n) method when n == 0

    kind regards,

    Jos

Similar Threads

  1. Not getting a response for query
    By Kelly in forum JDBC
    Replies: 3
    Last Post: 04-20-2010, 03:41 AM
  2. Query MySQL
    By boss in forum Advanced Java
    Replies: 3
    Last Post: 01-04-2010, 09:35 AM
  3. MySQL/JDBC Mysql query output
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-13-2009, 01:57 AM
  4. MySQL/JDBC Prepared Statement Select query
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-12-2009, 05:29 PM
  5. Mysql/JDBC update query problem
    By thelinuxguy in forum Advanced Java
    Replies: 3
    Last Post: 02-11-2009, 09:56 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
  •