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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:30:40+00:00 2026-06-14T02:30:40+00:00

I am writing the following SQL query in my Java program PreparedStatement pre =

  • 0

I am writing the following SQL query in my Java program

PreparedStatement pre = conn.prepareStatement("select ID,FirstName,LastName,Dept from "                 
    + "student where ID =" + ID + " or FirstName=" + firstName + ";");

However, I am getting the following error:

use the right syntax for FirstName=”+Parker

How is this caused and how can I solve it?

  • 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-14T02:30:42+00:00Added an answer on June 14, 2026 at 2:30 am

    You should take advantage of prepared statements by making use of prepared statements parameters. This way, you can set your parameters pragmatically using setters.

    http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html.

    Here is a snippet from the Oracle docs:

    PreparedStatement updateSales = null;
    

    String updateString = “update ” + dbName + “.COFFEES ” + “set SALES =
    ? where COF_NAME = ?“;

    updateSales = con.prepareStatement(updateString);
    
    updateSales.**setInt**(1, e.getValue().intValue());
    
    updateSales.**setString**(2, e.getKey());
    

    Just make sure you set the statements *in order a*s the sql query.

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

Sidebar

Related Questions

Possible Duplicate: Writing an SQL query to SELECT item from the following table I
I've seen people writing the following query SELECT column_name(s) FROM table_name1 LEFT JOIN table_name2
So in this program I'm writing, I actually grab a SQL query from the
I have the following SQL query: SELECT DISTINCT ProductNumber, PageNumber FROM table I am
Let's say I have the following simple query SELECT TOP 1 name FROM months
I am using SQL Server Management Studio 2008 and writing the following query INSERT
Following is a T_SQL query for AdventureWorks database: SELECT Name FROM Production.Product WHERE ListPrice
I am writing an sql query using pivot and I am getting following errors:
By writing the following query SELECT item_name, YEAR( DATE ) , SUM( item_sold_qty )
I am writing the following in LINQ Enumerable.Range(50, 100).Select(n => n/10 == 1) but

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.