Java Basic Tutorial
Java Advance Tutorial
Once you have successfully established a JDBC connection, you can execute SQL queries (SELECT, INSERT, UPDATE, DELETE) using Statement or PreparedStatement.
🔹 executeQuery() → Used for SELECT queries (returns ResultSet).
🔹 ResultSet → Stores the retrieved data from the database.
🔹 rs.next() → Moves to the next row in the result set.
🔹 executeUpdate() → Used for INSERT, UPDATE, DELETE (returns affected row count).
🔹 pstmt.setString(1, "John Doe") → Sets the first placeholder (?).
🔹 pstmt.setString(2, "Manager") → Sets the second placeholder (?).