Languages
[Edit]
EN

Java - how to make MySQL update query with JDBC?

1 points
Created by:
RomanaLittle
458

In Java it is possible to make SQL UPDATE query with JDBC in following way.

Note: read this article to know how to download and install JDBC driver proper way.

1. UPDATE query with JDBC example

Edit

Note: this approach prevents of SQL Injection attack.

Output:

Database:

Database state after SQL UPDATE query with PDO class - HeidiSQL.
Database state after SQL UPDATE query with JDBC class - HeidiSQL.

2. Data base preparation

Edit

create_tables.sql file:

insert_data.sql file:

See also

Edit
  1. Java - how to make MySQL insert query with JDBC?
  2. Java - how to make MySQL select query with JDBC?
  3. Java - how to make MySQL delete query with JDBC?
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - MySQL

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join