cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Tata <sandeep.t...@gmail.com>
Subject Re: Sample Client Code
Date Fri, 10 Apr 2009 00:59:12 GMT
Sure.
There wan another user on the old lists using Cassandra to store images, see:

http://groups.google.com/group/cassandra-user/browse_thread/thread/6dc9bbb39b3b00f4/3f364cb072e6ef00?lnk=gst&q=staubo#3f364cb072e6ef00

Off the top of my head,  one way would be to base64 encode the file so
you could hand it as a string to the thrift interface. Not ideal, but
it would work.

On Thu, Apr 9, 2009 at 5:40 PM, Sam D <technologylist@gmail.com> wrote:
> Thanks Jonathan, it issue was due to some connectivity issues.  Its working
> fine now.
>
> I had one more question.
>
> Can we insert byte arrays as values for the columns ?. I am trying to store
> JPEG images.
>
> Thanks
>
> On Thu, Apr 9, 2009 at 2:38 PM, Jonathan Ellis <jbellis@gmail.com> wrote:
>>
>> So content:xml is your ColumnFamily:column tuple.  That looks right.
>>
>> That exception is from the client side, right?  That looks to me like
>> it can't connect to the server.
>>
>> Your connection code looks okay... port should be the thrift port,
>> 9160 if you haven't changed it.
>>
>> On Thu, Apr 9, 2009 at 4:31 PM, Sam D <technologylist@gmail.com> wrote:
>> > No, its not a supercolumn, how do I retrieve it if its not a supercolumn
>> > ?.
>> >
>> >      <Table Name = "xmls">
>> >        <ColumnFamily ColumnSort="Name" Name="content"/>
>> >      </Table>
>> >
>> > I didn't notice it earlier, but yes, I am seeing the following exception
>> > in
>> > the log
>> >
>> > Exception in thread "main"
>> > com.facebook.thrift.transport.TTransportException: Cannot write to null
>> > outputStream
>> >     at com.facebook.thrift.transport.TIOStreamTransport.write(Unknown
>> > Source)
>> >     at com.facebook.thrift.protocol.TBinaryProtocol.writeI32(Unknown
>> > Source)
>> >
>> > Thanks
>> >
>> > On Thu, Apr 9, 2009 at 2:24 PM, Jonathan Ellis <jbellis@gmail.com>
>> > wrote:
>> >>
>> >> is content a supercolumn?  otherwise specifying a subcolumn isn't going
>> >> to
>> >> work.
>> >>
>> >> did you check your log file for exceptions?
>> >>
>> >> On Thu, Apr 9, 2009 at 4:19 PM, Sam D <technologylist@gmail.com> wrote:
>> >> > Thanks for the quick response,
>> >> >
>> >> > I have only one node. So the web client also should see the data,
>> >> > right
>> >> > ?.
>> >> > Below is the code which I am using to read.
>> >> >
>> >> >        socket = new TSocket(machine,port);
>> >> >         TProtocol tp = new TBinaryProtocol(socket);
>> >> >         cl = new Cassandra.Client(tp);
>> >> >         socket.open();
>> >> >         column_t u1 = cl.get_column("xmls","x1","content:xml");
>> >> >         System.out.println("xml : " + u1.value);
>> >> >
>> >> > Sam.
>> >> >
>> >> > On Thu, Apr 9, 2009 at 2:07 PM, Jonathan Ellis <jbellis@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> That looks reasonable.  How are you reading the data back out?
 The
>> >> >> web interface only hits the local machine so it is not very useful
>> >> >> in
>> >> >> a clustered situation.
>> >> >>
>> >> >> -Jonathan
>> >> >>
>> >> >> On Thu, Apr 9, 2009 at 4:02 PM, Sam D <technologylist@gmail.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > I am new to Cassandra, just installed the latest version on
my
>> >> >> > machine.
>> >> >> > I
>> >> >> > am able to insert rows using the web (@7002), but I am not
able to
>> >> >> > get a
>> >> >> > java client to insert rows into a table. Below the piece of
code I
>> >> >> > am
>> >> >> > using,
>> >> >> > the insert call goes through fine without any exceptions,
but I am
>> >> >> > not
>> >> >> > able
>> >> >> > to see the row in the table, so I assume its not being inserted
>> >> >> > properly.
>> >> >> >
>> >> >> >         socket = new TSocket(machine,port);
>> >> >> >         TProtocol tp = new TBinaryProtocol(socket);
>> >> >> >         cl = new Cassandra.Client(tp);
>> >> >> >         socket.open();
>> >> >> >         cl.insert("xmls", "x1", "content:xml", "xyz",
0);
>> >> >> >
>> >> >> > Can you please point me to any sample code available which
I can
>> >> >> > refer
>> >> >> > to ?.
>> >> >> >
>> >> >> > Thanks
>> >> >> > Sam.
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>

Mime
View raw message