From cassandra-user-return-27-apmail-incubator-cassandra-user-archive=incubator.apache.org@incubator.apache.org Fri Apr 10 19:33:15 2009 Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 22391 invoked from network); 10 Apr 2009 19:33:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Apr 2009 19:33:15 -0000 Received: (qmail 76719 invoked by uid 500); 10 Apr 2009 19:33:15 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 76681 invoked by uid 500); 10 Apr 2009 19:33:15 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 76668 invoked by uid 99); 10 Apr 2009 19:33:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Apr 2009 19:33:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of technologylist@gmail.com designates 74.125.46.154 as permitted sender) Received: from [74.125.46.154] (HELO yw-out-1718.google.com) (74.125.46.154) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Apr 2009 19:33:06 +0000 Received: by yw-out-1718.google.com with SMTP id 6so958184ywa.0 for ; Fri, 10 Apr 2009 12:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=9ohgJEdaDlfUADMOu8Rzjt+1ZEPWX+NZv/DKkbi3fCk=; b=lQ563vIk4l70Wrf87tSEe2CIkot/aYsXrlq+rzSs60IHR4JX7jyK9b1DdpG4HaHRRR vnjwWIi4uEP2BLkIhPHFgmYfiBOSIbe0OHDW54izj8bWbZ3oPt0z1mJhhFE2IORJXzE0 R0vndkuGxAQrl5R91qKU/wbY1sgkTcGB6KW5o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=KPe0UI0VMsmXgFhYajkOwlRxP7Wi1i3PI76zgZgJ+rHlFyJDlbNCMO0miChLv8u4ji KiseAZmnMUrgTF4gnKaitZ3aN1wxLAKtM9Amvi7KBoZZi8WwqFMRND+jfxyxAnEczCTH 4raKg0RIHidxhDdgOySXIpKOqDXpqFFbNJi9w= MIME-Version: 1.0 Received: by 10.100.10.15 with SMTP id 15mr3406835anj.6.1239391965652; Fri, 10 Apr 2009 12:32:45 -0700 (PDT) In-Reply-To: References: <3317711b0904091402l6c5e998wf310cd3934982074@mail.gmail.com> <3317711b0904091419r37f83ad7y9f62f171ea3a5a9e@mail.gmail.com> <3317711b0904091431i2bedd99elab7039794fa70b46@mail.gmail.com> <3317711b0904091740w8f61aaeif7320e8fc85cfe16@mail.gmail.com> Date: Fri, 10 Apr 2009 12:32:45 -0700 Message-ID: <3317711b0904101232ob4b5912nf40c08c8d0e65a79@mail.gmail.com> Subject: Re: Sample Client Code From: Sam D To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=0016e64652fad9ab580467386d3b X-Virus-Checked: Checked by ClamAV on apache.org --0016e64652fad9ab580467386d3b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks. I am able to load and retrieve files from Cassandra now. On Thu, Apr 9, 2009 at 6:25 PM, Jonathan Ellis wrote: > For now you'll have to encode it somehow. > > We have a ticket (https://issues.apache.org/jira/browse/CASSANDRA-29) > to switch to binary data as column values and that's high on my list > to get done. > > -Jonathan > > On Thu, Apr 9, 2009 at 7:40 PM, Sam D 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 > 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 wrote: > >> > No, its not a supercolumn, how do I retrieve it if its not a > supercolumn > >> > ?. > >> > > >> > > >> > > >> >
> >> > > >> > 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 > >> > 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 > 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 > >> >> > 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 > >> >> >> 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. > >> >> >> > > >> >> > > >> >> > > >> > > >> > > > > > > --0016e64652fad9ab580467386d3b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks. I am able to load and retrieve files from Cassandra now.

On Thu, Apr 9, 2009 at 6:25 PM, Jonathan Ellis <j= bellis@gmail.com> wrote:
For now you'll have to encode it somehow.

We have a ticket (https://issues.apache.org/jira/browse/CASSANDRA-29<= /a>)
to switch to binary data as column values and that's high on my list to get done.

-Jonathan

On Thu, Apr 9, 2009 at 7:40 PM, Sam D <
technologylist@gmail.com> wrote:
> Thanks Jonathan, it issue was due to some connectivity issues.=A0 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. =A0That looks ri= ght.
>>
>> That exception is from the client side, right? =A0That 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> wrot= e:
>> > No, its not a supercolumn, how do I retrieve it if its not a = supercolumn
>> > ?.
>> >
>> > =A0=A0=A0=A0 <Table Name =3D "xmls">
>> > =A0=A0=A0=A0=A0=A0 <ColumnFamily ColumnSort=3D"Name&q= uot; Name=3D"content"/>
>> > =A0=A0=A0=A0 </Table>
>> >
>> > I didn't notice it earlier, but yes, I am seeing the foll= owing exception
>> > in
>> > the log
>> >
>> > Exception in thread "main"
>> > com.facebook.thrift.transport.TTransportException: Cannot wri= te to null
>> > outputStream
>> > =A0=A0=A0 at com.facebook.thrift.transport.TIOStreamTransport= .write(Unknown
>> > Source)
>> > =A0=A0=A0 at com.facebook.thrift.protocol.TBinaryProtocol.wri= teI32(Unknown
>> > Source)
>> >
>> > Thanks
>> >
>> > On Thu, Apr 9, 2009 at 2:24 PM, Jonathan Ellis <jbellis@gmail.com>
>> > wrote:
>> >>
>> >> is content a supercolumn? =A0otherwise specifying a subco= lumn 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.
>> >> >
>> >> > =A0=A0 =A0=A0=A0 socket =3D new TSocket(machine,port= );
>> >> > =A0=A0=A0 =A0=A0=A0 TProtocol tp =3D new TBinaryProt= ocol(socket);
>> >> > =A0=A0=A0 =A0=A0=A0 cl =3D new Cassandra.Client(tp);=
>> >> > =A0=A0=A0 =A0=A0=A0 socket.open();
>> >> > =A0=A0=A0=A0 =A0=A0 column_t u1 =3D cl.get_column(&q= uot;xmls","x1","content:xml");
>> >> > =A0=A0=A0 =A0=A0=A0 System.out.println("xml : &= quot; + u1.value);
>> >> >
>> >> > Sam.
>> >> >
>> >> > On Thu, Apr 9, 2009 at 2:07 PM, Jonathan Ellis <<= a href=3D"mailto:jbellis@gmail.com" target=3D"_blank">jbellis@gmail.com= >
>> >> > wrote:
>> >> >>
>> >> >> That looks reasonable. =A0How are you reading th= e data back out? =A0The
>> >> >> 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@gmai= l.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > I am new to Cassandra, just installed the l= atest 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. Be= low the piece of code I
>> >> >> > am
>> >> >> > using,
>> >> >> > the insert call goes through fine without a= ny exceptions, but I am
>> >> >> > not
>> >> >> > able
>> >> >> > to see the row in the table, so I assume it= s not being inserted
>> >> >> > properly.
>> >> >> >
>> >> >> > =A0=A0=A0 =A0=A0=A0 socket =3D new TSocket(= machine,port);
>> >> >> > =A0=A0=A0 =A0=A0=A0 TProtocol tp =3D new TB= inaryProtocol(socket);
>> >> >> > =A0=A0=A0 =A0=A0=A0 cl =3D new Cassandra.Cl= ient(tp);
>> >> >> > =A0=A0=A0 =A0=A0=A0 socket.open();
>> >> >> > =A0=A0=A0 =A0=A0=A0 cl.insert("xmls&qu= ot;, "x1", "content:xml", "xyz", 0);
>> >> >> >
>> >> >> > Can you please point me to any sample code = available which I can
>> >> >> > refer
>> >> >> > to ?.
>> >> >> >
>> >> >> > Thanks
>> >> >> > Sam.
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>

--0016e64652fad9ab580467386d3b--