Reputation: 111
I'm using Datastax 4.2 and Cassandra 3.11.4. I have 3 nodes deployed and am trying to execute query, but ResultSet doesn't return the value. However, in datastax version 3.7.2 it returns the value. I think they have changed the output format, but I can't figure it out.
CqlSession sessionOne = CqlSession.builder().addContactPoint(addrSocOne).withLocalDatacenter("us-east-2").withKeyspace("test").build();
String query = "select id FROM samplequeue";
ResultSet rs = sessionOne.execute(query);
System.out.println(rs);
sessionOne.close();
The output is : com.datastax.oss.driver.internal.core.cql.SinglePageResultSet
It does not contain the value of id, whereas in the previous version it did. Can anyone help me resolve the op? I need the value of id. It works fine from backend. I have already tried looping the resultset with row, but op is same.
Upvotes: 1
Views: 464
Reputation: 2196
Can you try something like this (Assuming it's an INT - otherwise choose your datatype)?:
for (Row row : rs) {
System.out.println("Item: " + row.getInt("item"));
}
Upvotes: 1