I'm running unto a problem with the Resultset.Next() method in Java8. The following code connects to a SQLite database file and attempts to read all the tables contained in the db.
// Set the connection up with jdbc and sqlite.
Connection connection = DriverManager.getConnection("jdbc:sqlite:file.db");
Statement statement = connection.createStatement();
statement.setQueryTimeout(30);
// Get all the tables in the DB so we can check that we have all we need.
ResultSet trs = statement.executeQuery("SELECT name FROM sqlite_master WHERE type='table';");
while (trs.next()) {
String tblname = trs.getString("name").toLowerCase();
log.log(Level.INFO, "Found table: " + tblname);
The database contains 2 tables (verified by running the query in the sqlite3 client), but the while loop only does one iteration before exiting.
Any suggestions as to why the last table gets ignored?
Aucun commentaire:
Enregistrer un commentaire