incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Morton <aa...@thelastpickle.com>
Subject Re: Cassandra With C++
Date Mon, 08 Nov 2010 19:32:23 GMT
Not sure if this is the problem but the default in 0.7* is to used framed transport, which
means creating the TFramedTransport rather than TBufferedTransport. 

How are you connecting with python? Is it using framed transport?

Hope that helps. 
Aaron

On 09 Nov, 2010,at 07:55 AM, David Replogle <david.replogle@steketeegreiner.com> wrote:

I'm using Cassandra 0.7beta3 and it's running on localhost:9160 and Python works with it just
fine. So, I go to run C++ against the system and I get:

TTransportException: No more data to read.

I did the thrift --gen cpp interface/cassandra.thrift in my 0.7beta3 folder
then included those files in the C++ code, and it builds fine, and runs.

It bombs out on the set_keyspace call... the code is short so I'll paste it here (not counting
includes and using calls):

---

const string host("localhost");
const int port= 9160;

int main()
{
    try {
        boost::shared_ptr<TSocket> socket(new TSocket(host, port));
        boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
        boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));

        CassandraClient client(protocol);
        transport->open();

        string version;
        client.set_keyspace("Crawldata");
        transport->close();
    } catch (apache::thrift::transport::TTransportException &tte) {
        cout << "TTransportException: " << tte.what() << endl;
    }
    return 0;
}

---

It throws this same error with a series of other calls. This is probably (hopefully) something
stupid I'm missing. Do I really need to run the C++ server component (which seems superfluous
since it's not actually my Cassandra instance) as detailed here: http://wiki.apache.org/thrift/ThriftUsageC%2B%2B

-- 
David Replogle | Senior Programmer Analyst

Catalyst SGC
44 Grandville Ave SW, Ste. 270, Grand Rapids, MI 49503
Office: 616.855.5522 x204 | Mobile: 616.293.2788


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message