It is really freaking me out. In my code I hand over a generated uuid as my private Key. Now I want to select from a table with only one value inside (avg_distance_as). Everything works fine when I write the statement with a fix uuid. But because I want to get the specific row with my current uuid, I want to put that in my statement too.
soooo no error nothing - he does not even call the syso in the rs.next loop. This one is working:
public int getavgDistanceAs(String uuid) {
try {
Class.forName("org.sqlite.JDBC");
con = DriverManager.getConnection("jdbc:sqlite:test.db");
statement = con.prepareStatement("Select avg_distance_as, UUID from avg_distance");
System.out.println(uuid);
statement.setString(1, uuid);
ResultSet rs = statement.executeQuery();
while (rs.next()) {
System.out.println(rs.getDouble(1));
System.out.println("test");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
statement.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return 0;
}
But this one isn't and it looks PRETTY much the same:
statement = con.prepareStatement("Select avg_distance_as, UUID from avg_distance where UUID = ?");
statement.setString(1, uuid);
Would be awesome if someone could help :)
Aucun commentaire:
Enregistrer un commentaire