SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

JDBC / NOTES</>↗
JDBC06 Mar 2007

How do I check if a cursor is in the first row?

When iterating the scrollable result-sets, you can check whether you are in the beginning of the result set or not. The isBeforFirst() method check if the position is at the beginning, if yes this method returns true, otherwise it will return false. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public […]

Wayan · 2 min read
JDBC / NOTES</>↗
JDBC01 Mar 2007

How do I move a cursor to the last record?

To move the cursor to the end of result-set (after the last record), you can call the afterLast() method of the ResultSet. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class ScrollableAfterLastExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final […]

Wayan · 2 min read
JDBC / NOTES</>↗
JDBC01 Mar 2007

How do I move a cursor in scrollable ResultSet?

package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class ScrollableMoveExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final String PASSWORD = "s3cr*t"; public static void main(String[] args) { try (Connection connection = DriverManager.getConnection(URL, U...

Wayan · 2 min read
JDBC / NOTES</>↗
JDBC25 Feb 2007

How do I use DatabaseMetaData to get table column names?

In this example, we are using the DatabaseMetaData to retrieve table’s column names. The metadata information can be obtained by calling the connection.getMetaData(). Next, we can then get a ResultSet object by calling metadata.getColumns() method and passing the catalog name, schema pattern, table name pattern, and column name pattern. From this result set COLUMN_NAME, TYPE_NAME, […]

Wayan · 2 min read
JDBC / NOTES</>↗
JDBC24 Feb 2007

How do I get column’s precision and scale value?

For instance, you have a number or double typed column in a database table, and you want to get the precision and the scale of that column. Here is an example for you. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; public class ScaleAndPrecisionExample { private static final String […]

Wayan · 1 min read
JDBC / NOTES</>↗
JDBC23 Feb 2007

How do I know the designated column’s table name?

package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; public class TableNameOfColumnExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final String PASSWORD = "s3cr*t"; public static void main(String[] args) { try (Connection connectio...

Wayan · 2 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

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

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.