I am trying to select data from my db, but instead of getting a certain field I get “”.
My table name is locations and it’s look like this:
id – int,
location – varchar and time – timestamp.
I would like to select the last location based on the time, here is my code:
this.select = this.conn.createStatement();
ResultSet result = select.executeQuery("SELECT location FROM locations ORDER BY time DESC Limit 1");
result.next();
System.out.println(result.getString(1));
I remind you the output is “”;
To identify the column in your resultSet you can use: