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

  • SEARCH
  • Home
  • 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 6253971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:06:52+00:00 2026-05-24T14:06:52+00:00

Alright, so I’m trying to store data in Sqlite. So I’m trying to store

  • 0

Alright, so I’m trying to store data in Sqlite. So I’m trying to store the id of the user with the a “line”. Yet, it seems that the where clause is failing me.

    String query = "SELECT * FROM Users WHERE username='Fellixombc";
    ResultSet result = this.sqlStatement.executeQuery(query);
    int userId = 0;
    while(result.next()) {
        System.out.println("TRUE");
        userId = result.getInt("id");
        System.out.println(result.getString("username"));
    }

And true is not printing. Yet, if I remove the WHERE clause from the query, it will print out all of the usernames/id’s fine, and of course “TRUE”.

Am I missing something with Sqlite and it’s syntax?

edit: Just to clarify there is a user in the Users column with the id of 1 and with the username Fellixombc
edit: So I took your guy’s suggestion and tried prepare statement, heres my code now:

        PreparedStatement sqlStatement = this.sqlConnection.prepareStatement("SELECT * FROM Users WHERE username=?");
        sqlStatement.setString(1, "Fellixombc");
        ResultSet result = sqlStatement.executeQuery();
        int userId = 0;
        while(result.next()) {
            System.out.println("TRUE");
            userId = result.getInt("id");
            System.out.println(result.getString("username"));
        }
        result.close();
  • 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-05-24T14:06:53+00:00Added an answer on May 24, 2026 at 2:06 pm

    Essentially, you want to store the username, correct?

    Your current query will retrieve all information on relative to a username. It’s what a SELECT query does, it retrieves.

    If you need to create a new user, use:

    INSERT INTO Users (username) Values ('Fellixombc');
    

    I should tell you that you might need to provide more information in this query, depending on what other fields your Users table has.

    EDIT:

    In your select statement, you have an open single quote.

    "SELECT * FROM Users WHERE username='Fellixombc"
    

    should be

    "SELECT * FROM Users WHERE username='Fellixombc'"
    

    To avoid issues with SQL injection, consider the prepareStatement function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I am trying to accomplish this: When a user clicks a button that
Alright, I'm trying to read a comma delimited file and then put that into
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, I have some data that I need to assign an int type identifier
Alright, so I've been trying to implement a simple binary search tree that uses
Alright, currently I have my SWF hitting a php file that will go and
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, after doing a ton of research and trying almost every managed CPP Redist
Alright so this is a bizarre cross platform thing that I'm experiencing with text

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.