I use Java, JDBC, PreparedStatement. It is necessary to select from the database 1 entry. But only when it appears, the moment the record appears in the database from 1s to 30. That is, I need a cycle. I understand how it algorithmically looks. But due to poor knowledge of Java syntax, JDBC cannot organize this loop. I see it this way, I arrange the connection, I write the select, if the request returns zero, then I continue to select, until the value returns, after the value of the assert I can check it, of course. Solve the loop either through true / false or 1 - 0. Request to experts to help in solving.
import java.sql.*; class Test1 { public static void main (String[] args) { try { String url = "jdbc:msql://10.10.10.10:1114"; Connection conn = DriverManager.getConnection(url,"",""); Statement stmt = conn.createStatement(); ResultSet rs; rs = stmt.executeQuery("SELECT ID FROM TABLE"); while ( rs.next() ) { String numID = rs.getString("ID"); System.out.println(numID); } conn.close(); } catch (Exception e) { System.err.println(e.getMessage()); } } }