當我運行這個程序時,我在輸出屏幕中得到了這個。我不知道有什麼問題是我有什麼缺少的。如何從結果集中檢索列值
import org.apache.cassandra.cql.jdbc.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.*;
import javax.sql.*;
public class Operations
{
public static void main(String[] args){
try
{
Class.forName("org.apache.cassandra.cql.jdbc.CassandraDriver");
Connection con = DriverManager.getConnection("jdbc:cassandra://localhost:9160/temp");
//String name = "name";
String qry = "select name FROM tempcql where key = detail";
Statement smt = con.createStatement();
ResultSet resultSet = smt.executeQuery(qry);
while(resultSet.next())
{
System.out.println(resultSet.getString("name"));
}
}
catch(Exception e)
{
System.out.println(" : "+e.getMessage());
}
}
}
這裏是這樣的輸出:java.nio.HeapByteBuffer [POS = 86 LIM = 91 =帽159]
我這樣做,但它不工作。同樣的結果我再次得到 – 2012-07-06 13:09:21