getColumnDefinitions only returns meta data, to get the data, use the iterator to navigate the rows

Iterator<Row> it = result.iterator();

while (it.hasNext()) {
    Row r =;
    //do stuff with row

On 04/21/2013 12:02 AM, Techy Teck wrote:
I am working with Datastax java-driver. And I am trying to retrieve few columns from the database basis on the input that is being passed to the below method-

public Map<String, String> getAttributes(final String userId, final Collection<String> attributeNames) {

String query="SELECT " +attributeNames.toString().substring(1, attributeNames.toString().length()-1)+ " from profile where id = '"+userId+ "';";

ResultSet result = CassandraDatastaxConnection.getSession().execute(query);

Map<String, String> attributes = new ConcurrentHashMap<String, String>();
for(Definition def : result.getColumnDefinitions()) {
//not sure how to put the columnName and columnValue that came back from the database
attributes.put(column name, column value);
return attributes;

Now I got the result back from the database in result

Now how to put the colum name and column value that came back from the database in a map?

I am not able to understand how to retrieve colum value for a particular column in datastax java driver?

Any thoughts will be of great help.