database connector for CASSANDRA

433 views
Skip to first unread message

Stéphane MERLE

unread,
Mar 5, 2015, 5:36:50 AM3/5/15
to lu...@googlegroups.com
Hi,

I just install my first VM with lucee (been using railo for now ;) ), and I would like to try the cassandra BDD to replace MSSQL ... is there a simple way to setup the connector ?

http://cassandra.apache.org/

Thanks for your help

Stéphane

Chris Blackwell

unread,
Mar 5, 2015, 5:56:28 AM3/5/15
to lu...@googlegroups.com
I've never used Cassandra, but a quick google turns up a jdbc compliant driver.  So thats where i'd start

install that, along with any dependencies in your /lib directory, restart lucee/tomcat and then create a datasource of type "Other" with a type of "org.apache.cassandra.cql.jdbc.CassandraDriver".

From there, you'll have to experiment and see what happens




--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/a04008ac-f36d-4553-a689-a984d2dec509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stéphane MERLE

unread,
Mar 5, 2015, 6:52:44 AM3/5/15
to lu...@googlegroups.com
"From there, you'll have to experiment and see what happens"
this is where I got stuck ;)

expecially with the connection string ... I found : http://stackoverflow.com/questions/26584607/using-apache-cassandra-in-coldfusion
I try to experiment around this ... with no luck for now ... I was expecting something as simple as MSSQL connectors ....sic ...

Thanks for your help !!

Stéphane

Igal @ Lucee.org

unread,
Mar 5, 2015, 12:17:47 PM3/5/15
to lu...@googlegroups.com
a couple of pitfalls that you might want to avoid:

1) the jdbc driver requires several files and they should all be in your classpath (unlike most drivers that keep all the prerequisites in one jar).

2) the connection string in the SO link that you posted contains exemplary, unneeded, arguments, for example it specifies multiple hosts, multiple datacenters, and most importantly a "database" named "keyspace1" which if you don't have (and there's a good chance you don't) will throw an unrelated error message which will throw you in a wild goose chase.

you can easily define a datasource named "cassandra" by adding this into your Application.cfc body assuming localhost, port 9160, and a database named "test":

  this.datasources.cassandra = {
     class: 'org.apache.cassandra.cql.jdbc.CassandraDriver'
    ,connectionString: 'jdbc:cassandra://localhost:9160/test?consistency=QUORUM'
  };


Igal Sapir
Lucee Core Developer
Lucee.org

Stéphane MERLE

unread,
Mar 6, 2015, 6:41:16 AM3/6/15
to lu...@googlegroups.com
Thanks IGAL,

for 1) I think I did good ...
for 2) I use the admin connection manager like that the dev doesnt get too much informations on the production databases ... but I get this error after validating :

org.apache.thrift.transport.TTransportException: Cannot write to null outputStream


I use : 

CLASS : org.apache.cassandra.cql.jdbc.CassandraDriver
Connection String : jdbc:cassandra://IPV4:9160/mykeyspace?consistency=QUORUM

where ipv4 is the ip of the cassandra server (only one for now)
I am assuming that TEST is the keyspace, which I created with the name : "mykeyspace" so this should work ...

my main problem is to know if it's a cassandra config error or railo/lucee/jdbc ...for now, there is NO firewall between the 2 serveurs ...

Stéphane



Igal @ Lucee.org

unread,
Mar 6, 2015, 10:35:29 AM3/6/15
to lu...@googlegroups.com
yes, "test" was a keyspace in that example.

do you have a full stacktrace of the error?  please post it.



Igal Sapir
Lucee Core Developer
Lucee.org

Stéphane MERLE

unread,
Mar 19, 2015, 5:59:02 PM3/19/15
to lu...@googlegroups.com
Thanks IGAL !

I did it, just needed to setup a little more the one node "cluster" of test for cassandra ...

Thanks for your time !

Stéphane

Igal @ Lucee.org

unread,
Mar 20, 2015, 6:04:44 AM3/20/15
to lu...@googlegroups.com
I'm glad you got it to work!


Igal Sapir
Lucee Core Developer
Lucee.org

Anders Thulin

unread,
Jun 30, 2015, 6:40:20 AM6/30/15
to lu...@googlegroups.com
Did anyone make the jdbc driver to work on Lucee?

I have downloaded the google project and dependencies to /lib and restarted Lucee.

Setting up the data source with other -JDBC Driver and get stucked.

Class: org.apache.cassandra.cql.jdbc.CassandraDriver
Connection string; jdbc:cassandra://host1--host2--host3:9160/keyspace1?primarydc=DC1&backupdc=DC2&consistency=QUORUM


I get a strange Lucee Admin message

tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory

The 2nd time I try I just get: 
Could not initialize class org.apache.cassandra.cql.jdbc.CassandraDriver

Im running the latest DataStax Cassandra  2.0.13 
and
Lucee 4.5.1.008 final 

CQL Shell access works fine.

Any ideas?

David Sedeño

unread,
Jul 1, 2015, 10:05:40 AM7/1/15
to lu...@googlegroups.com
Hi Anders,

I have setup the datasource successfuly with the connection string:

jdbc:cassandra://ipaddress:9160/keyspace?consistency=QUORUM

(only one ipaddress, I couldn't setup the other nodes ip address)
---
David

Anders Thulin

unread,
Jul 24, 2015, 6:53:19 AM7/24/15
to Lucee, tco...@gmail.com
Great, whats the trick then?

I managed to solve the slf4j error by downloading the latest version of that.
But now I get the same error as Stéphane:

org.apache.thrift.transport.TTransportException: Cannot write to null outputStream

Do I need to make changes to cassandra.yaml?

Anders Thulin

unread,
Jul 24, 2015, 8:03:11 AM7/24/15
to Lucee, tco...@gmail.com, anders...@comintelli.com
Solved it.
cassandra.yaml had wrong setting.
enabled by start_rpc: true
Reply all
Reply to author
Forward
0 new messages