incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From puneet loya <puneetl...@gmail.com>
Subject cassandra and .net
Date Tue, 10 Apr 2012 05:26:11 GMT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Thrift.Collections;
using Thrift.Protocol;
using Thrift.Transport;
using Apache.Cassandra;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            TTransport transport=null;
            try
            {
                transport = new TBufferedTransport(new TSocket("127.0.0.1",
7000));


                //if(buffered)
                //            trans = new TBufferedTransport(trans as
TStreamTransport);
                //if (framed)
                //    trans = new TFramedTransport(trans);

                TProtocol protocol = new TBinaryProtocol(transport);
                Cassandra.Client client = new Cassandra.Client(protocol);

                Console.WriteLine("Opening connection");

                if (!transport.IsOpen)
                    transport.Open();

                client.describe_keyspace("abc");               // Crashing
at this point

          }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            { if(transport!=null)
                transport.Close(); }
            Console.ReadLine();
        }
    }
}

I m trying to interact with cassandra server(database) from .net. For that
i have referred two libraries i.e, apacheCassandra08.dll and thrift.dll..
In the following piece of code the connection is getting opened but when i
m using client object it is giving an error stating "Cannot read, Remote
side has closed".

Can any1 help me out with this? Has any1 faced the same prob?

Mime
View raw message