Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

JDBC / CATATAN</>
JDBC18 Jan 2026

How do I use auto-generated keys in JDBC?

To use auto-generated keys in JDBC (like an AUTO_INCREMENT primary key), you need to follow a three-step process: notify the statement you want the keys, execute the update, and then retrieve them from a special ResultSet. Here is a practical example using PreparedStatement: 1. Prepare the Statement When creating your PreparedStatement, you must pass the […]

Wayan · 2 menit baca
JDBC / CATATAN</>
JDBC18 Jan 2026

How do I batch insert data with JDBC?

To batch insert data with JDBC, you typically use the addBatch() and executeBatch() methods. This is much more efficient than executing individual INSERT statements because it reduces the number of round-trips between your application and the database. The most common and secure way to do this is with a PreparedStatement. Batch Insert with PreparedStatement Using […]

Wayan · 2 menit baca
JDBC / CATATAN</>
JDBC17 Jan 2026

How do I delete rows with JDBC?

To delete rows from a database using JDBC, you use the executeUpdate() method. This method is used for SQL statements that modify data (like DELETE, INSERT, or UPDATE) and returns an integer representing the number of rows affected. While you can use a simple Statement, it is highly recommended to use a PreparedStatement to prevent […]

Wayan · 2 menit baca
JDBC / CATATAN</>
JDBC17 Jan 2026

How do I insert rows with JDBC?

To insert rows into a database using JDBC, you typically use the executeUpdate(String sql) method of a Statement or PreparedStatement object. Here are the two primary ways to do it: 1. Using PreparedStatement (Recommended) This is the standard approach because it prevents SQL Injection and is more efficient for repeated inserts. package org.kodejava.jdbc; import java.sql.Connection; […]

Wayan · 2 menit baca
JDBC / CATATAN</>
JDBC16 Jan 2026

How do I update rows with executeUpdate?

In JDBC, the executeUpdate method is used for SQL statements that modify data, such as UPDATE, INSERT, or DELETE. Unlike executeQuery, which returns a ResultSet, executeUpdate returns an int representing the number of rows affected by the operation. Here is how you can update rows using PreparedStatement (the recommended way) and Statement. 1. Using PreparedStatement […]

Wayan · 2 menit baca
JDBC / CATATAN</>
JDBC16 Jan 2026

How do I fetch results with ResultSet?

To fetch results using a ResultSet in Java JDBC, you follow a standard pattern of executing a query, iterating through the rows, and extracting data using “getter” methods. Basic Fetching Pattern Execute the Query: Use stmt.executeQuery(sql) (for Statement) or pstmt.executeQuery() (for PreparedStatement). Iterate through Rows: Use a while (rs.next()) loop. The next() method moves the […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.