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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:11:12+00:00 2026-06-19T00:11:12+00:00

I am studying JDBC use on Spring Framework following this tutorial: http://www.tutorialspoint.com/spring/spring_jdbc_example.htm So I

  • 0

I am studying JDBC use on Spring Framework following this tutorial: http://www.tutorialspoint.com/spring/spring_jdbc_example.htm

So I have the following table named Student on my MySql DB:

mysql> describe Student;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| ID    | int(11)     | NO   | PRI | NULL    | auto_increment |
| NAME  | varchar(20) | NO   |     | NULL    |                |
| AGE   | int(11)     | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+

As you can see in the tutorial link I have an interface named StudentDAO that describe the CRUD operation on this Student table of my DAO object

Ok, looking at the StudentJDBCTemplate class: this is an implementation of the StudentDAO interface, so in this class I have all the implementation for the CRUD method declared inside the interface.

Ok…I have some doubt about the JDBC method mean in this class.

For example when I have something like:

public void create(String name, Integer age) {
    String SQL = "insert into Student (name, age) values (?, ?)";

    jdbcTemplateObject.update(SQL, name, age);
    System.out.println("Created Record Name = " + name + " Age = " + age);
    return;
}

Ok…I think that this method create a new record in my Student table.

The SQL variable contains a String that rappresents my query and here I have the first doubt

When I have:

String SQL = “insert into Student (name, age) values (?, ?)”;

what exactly mean? It means that the two input parameter of my create() take the place of the “name” and “age” int this String?

mmm…this sound strange for me, because this look like a String (infact is whithin “”)

The scond doubt is related to the following line:

jdbcTemplateObject.update(SQL, name, age);

If I have the SQL query inside the SQL String, why have I to pass also the variable name and age?

Can you help me to understand well how JDBC work?

Tnx

Andrea

  • 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-19T00:11:13+00:00Added an answer on June 19, 2026 at 12:11 am

    When I have:

    String SQL = "insert into Student (name, age) values (?, ?)";

    what exactly mean? It means that the two input parameter of my create() take the place of the "name" and "age" int this String?

    JDBC will replace the two ? placeholders with the appropriate values. This is seen as a good practice as it helps prevent SQL injection.

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

Sidebar

Related Questions

I am studyng Spring MVC and I have find this simple Hello World tutorial:
I'm studying Oleg's and Asai's delimited continuations for dummies paper(http://pllab.is.ocha.ac.jp/~asai/cw2011tutorial/main-e.pdf) but this paper uses
I am studying Spring MVC. Today, trying to understand how implement a JDBC DAO,
When studying carefully gproc project's gproc_tests.erl file. I have found the following code. The
I'm studying querulous and started with this code: import com.twitter.querulous.evaluator.QueryEvaluator class Querulous { def
I'm studying an application in C for ARM low-powered devices, I have this piece
I am studying 'Web Service' this week and found good tutorial and example code.
Studying compilers course, I am left wondering why use registers at all. It is
While studying for a Functional Programming exam, I came across the following questions from
While studying for a Functional Programming exam, I came across the following question from

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.