Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:30:06+00:00 2026-06-13T03:30:06+00:00

I am developing a two-tier java application that basically displays mySQL database results in

  • 0

I am developing a two-tier java application that basically displays mySQL database results in a JTable in a GUI. The mySQL queries are typed in by the user in a textArea and then an ‘execute command’ button is pressed and the mySQL results corresponding to that command simply appear in the JTable.

The problem I am running into is when I try to type in a query such as “SELECT * FROM bikes WHERE COST=10000;” everything works as expected and results are returned. However, if I type in “select * from bikes where cost=10000;”, no results are returned and basically nothing happens, not even getting an error. I tried running ‘toUpperCase()’ on the query, which didn’t fix the problem.

I was wondering what might be causing this problem? I am aware that mySQL is not case sensitive, so it should work even if my SELECT is lower case…
The code below is a snippet of the area that might be causing the problem.

public void setQuery(String query) throws SQLException, IllegalStateException{
        if(!connectedToDatabase)
            throw new IllegalStateException("Not Connected to Database");


        String firstWord = query.substring(0, 6);
        if(firstWord.toUpperCase().equals("SELECT")){           
            resultSet = statement.executeQuery(query);
        }
        else if(firstWord.toUpperCase().equals("INSERT") || firstWord.toUpperCase().equals("DELETE") || firstWord.toUpperCase().equals("UPDATE")){
            statement2.executeUpdate(query);
        }

        metaData = resultSet.getMetaData();

        resultSet.last();
        numberOfRows = resultSet.getRow();
        fireTableStructureChanged();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:30:07+00:00Added an answer on June 13, 2026 at 3:30 am
    • Try using equalsIgnoreCase instead of straight equals.
    • If you don’t know if the code is getting into an if block, try adding some logging into that block.
    • Assuming it is getting into the block, the query is likely causing the problem.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing two java programs that run in separate VM's that have a
While developing my Java EE application I've encountered two situations in which my entities
Im developing an application with java which needs to find two big integers (Y
Right now, I am developing two classes for interaction with a MySQL database -
I am developing an application that has two DLLs one is a 32bit version
I am developing an application in android java Eclipse having two list view side
I'm developing an web application that will be available in two languages and more
I'm developing two Ruby gems, one is a framework, the other is an application.
I'm developing a menu that has two modes, when the user clicks on one
I am developing a Application which takes two Files and output will be two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.