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 9116757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:45:01+00:00 2026-06-17T04:45:01+00:00

I have an sql table sysuser looking like this: id (pk) email password role

  • 0

I have an sql table sysuser looking like this:

id (pk) email password role

I’d like to insert values into the table. I get the data in ArrayList<String>:

cell 0 no value,
cell 1 ID,
cell 2 email,
cell 3 password,
cell 4 role,

Here is the code i’ve written:

stmt.executeUpdate("INSERT INTO sysuser VALUES ('"+string.get(1)+"', '"+ string.get(2) +"','"+ string.get(3) +"','"+string.get(4)+"'");

where string is the ArrayList<String>.

The code is not working and I can’t figure why. It works perfectly with another query. I get the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1

I read about prepared statments but I did not understand the syntax. I know that it is not safe to insert data directly, yet for this specific query it doesn’t matter.

  • 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-17T04:45:03+00:00Added an answer on June 17, 2026 at 4:45 am

    You forgot a )

    stmt.executeUpdate("INSERT INTO sysuser " + 
                        "VALUES ('" + string.get(1) + "','"+ 
                                      string.get(2) + "','"+ 
                                      string.get(3) + "','"+
                                      string.get(4) + "')");
                                                        ^------------here
    

    And if you are not filling all columns of your table you should provide a list of columns you are inserting into like this

    INSERT INTO sysuser (col_name_1, col_name2, col_name5, col_name7)
    VALUES (1, 2, 3, 4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL table which has reviews saved like this.... I am looking
I have an SQL table with columns like this: Person | Property 1 |
I have an SQL Table named samples, defined like this: sampledate (datetime, 24 records
I have an SQL table like this ID | ParentID 1 | null 2
I have a SQL table containing train schedules. The table looks something like this:
I have an SQL table that looks like this: CREATE TABLE diet_watch ( entry_date
I have one sql table that looks like this called posts: id | user
I have an SQL table called "posts" that looks like this: id | category
I have an SQL table called trainings that looks like this: +-----+-----------+--------+------------+------------+------------+-------+ | Id
I have a SQL table, which looks like this: id_question (int) | tags (varchar)

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.