JDBC (10) : Navigasi ResultSet

Oleh : Reza Ervani

Referensi :

  1. Tutorials Point – JDBC Introduction
  2. Vogella – MySQL and JDBC – Lars Vogel
  3. Eclipse & JDBC – Russell Bateman

بسم الله الرحمن الرحيم

Navigasi suatu Result Set:

Ada beberapa metode di antarmuka ResultSet untuk menggerakkan kursor, diantaranya :

No. Metode dan Deskripsi
1 public void beforeFirst() throws SQLException 
Menggerakan kursor tepat sebelum baris pertama
2 public void afterLast() throws SQLException 
Menggerakan kursor tepat setelah baris terakhir
3 public boolean first() throws SQLException 
Menggerakan kursor ke baris pertama
4 public void last() throws SQLException 
Menggerakan kursor ke baris terakhir
5 public boolean absolute(int row) throws SQLException 
Menggerakan kursor ke baris tertentu
6 public boolean relative(int row) throws SQLException 
Menggerakkan kursor ke sejumlah angka yang diberikan pada maju atau mundur dari posisinya saat ini
7 public boolean previous() throws SQLException 
Menggerakkan kursor ke baris sebelumnya. Metode ini akan menghasilkan false jika sebelumnya tidak ada atau diluar resultset.
8 public boolean next() throws SQLException 
Menggerakkan kursor ke baris berikutnya. Metode ini akan menghasilkan false jika tidak ada lagi baris di resultset.
9 public int getRow() throws SQLException 
Mengeluarkan angka baris dimana kursor berada.
10 public void moveToInsertRow() throws SQLException 
Menggerakan kursor ke baris spesial pada result set yang dapat digunakan untuk menyisipkan baris baru ke database. Lokasi kursor saat terakhir akan diingat.
11 public void moveToCurrentRow() throws SQLException 
Menggerakan kursor kembali ke baris saat ini jika kursor sedang berada di baris yang disisipkan, selain itu, metode ini tidak akan melakukan apa-apa.

Bersambung insya Allah (reza@rumahilmu.or.id)

About Reza Ervani 425 Articles
Adalah pendiri programming.rezaervani.com -

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.