So after playing with Play 2.1.x and scala for a good 2 months, and working out how to get and retrieve data from a relational database like mysql, i was asked to do the same with a NoSQL DB.
I initially started working through it with the attitude of "how different can it really be?"
Cassandra taught me in the first week how stupid i was to think that.. and after weeks of reading through texts like Making Sense of NoSQL,etc I finally understood a little bit. Anyway, let me just get to what i learnt.
So, after connecting my play app to cassandra, I got to inserting values into the DB, getting the syntax right was easy. Inserting values directly was easy too..
but in the real world, you need to input value from some variable and not directly and that's where i got stuck.
And the error i got looked like this
Doesn't say much, that was my first thought.. anyway, i kept trying to figure out what i was doing wrong.. and here is the mistake ...
" VALUES (" + id1.toLong + ", " + name1 + ", " + age1 + ", " + add1 + ");"
The values of name1 and add1 were both strings and when i was passing the query inside a String, any string inside the query needs to be inside SINGLE QUOTES. Do they say that in any of the documents and help files i poured through.. Nope.. its its supposed to be understood.. But I dint understand it.. Anyway , so here is the correct way of doing it. Hope it helps..
For someone who is an expert or even someone who has a little experience in the field, this might seems like a very small and inconsequential lesson. You might even brush it off as common sense.
But for a new comer like me, was it small? - yes, was it stupid? - maybe, but a lot of them out there might be looking for this simple answer. I know I looked in a lot of places and all I got was the Syntax which was passing values directly...
I initially started working through it with the attitude of "how different can it really be?"
Cassandra taught me in the first week how stupid i was to think that.. and after weeks of reading through texts like Making Sense of NoSQL,etc I finally understood a little bit. Anyway, let me just get to what i learnt.
So, after connecting my play app to cassandra, I got to inserting values into the DB, getting the syntax right was easy. Inserting values directly was easy too..
but in the real world, you need to input value from some variable and not directly and that's where i got stuck.
And the error i got looked like this
Doesn't say much, that was my first thought.. anyway, i kept trying to figure out what i was doing wrong.. and here is the mistake ...
" VALUES (" + id1.toLong + ", " + name1 + ", " + age1 + ", " + add1 + ");"
The values of name1 and add1 were both strings and when i was passing the query inside a String, any string inside the query needs to be inside SINGLE QUOTES. Do they say that in any of the documents and help files i poured through.. Nope.. its its supposed to be understood.. But I dint understand it.. Anyway , so here is the correct way of doing it. Hope it helps..
For someone who is an expert or even someone who has a little experience in the field, this might seems like a very small and inconsequential lesson. You might even brush it off as common sense.
But for a new comer like me, was it small? - yes, was it stupid? - maybe, but a lot of them out there might be looking for this simple answer. I know I looked in a lot of places and all I got was the Syntax which was passing values directly...


