incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Replogle <david.replo...@steketeegreiner.com>
Subject Re: Cassandra With C++
Date Mon, 08 Nov 2010 19:54:37 GMT
With Python I'm using the fantastic Pycassa library by Tyler (who previously
responded). Now I'm getting a "keyspace does not exist error" which I'm
trying to sort out right now... because, well, it does exist. I added the
following catch:

 catch (org::apache::cassandra::InvalidRequestException &ire) {
        cout << "InvalidRequestException: " << ire.why << endl;
    }

And now I get this output:

InvalidRequestException: Keyspace does not exist

On Mon, Nov 8, 2010 at 2:32 PM, Aaron Morton <aaron@thelastpickle.com>wrote:

> 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.apacheorg/thrift/ThriftUsageC%2B%2B<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
>
>


-- 
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
View raw message