I am trying to use ApacheCandra on a project which I am coding using ColdFusion. Since Coldfusion does not have a driver for Apache Cassandra and on the contrary, I am trying to use Cassandra's Java drivers.
I am quite a Java, so please come with me.
I have been able to copy the necessary .jar files to / opt / railo / lib / (I am using Railo) and using the code given below, using ColdFusion also uses Kassandra Has managed to join. When I want to piping through the results given by Cassandra to run a query, I have given my very simple code below:
How do I return the loop through the results? Cfdump Java Method Set ArrayBackedResultSet $ SinglePage. This is not something I can loop if I use coldfusion.
From the "Getting Started with Cassandra and Java" post, I see the code below:
ResultSet result = Session.execute (Select from * where the user is last Name = 'jones'); (row row: result) {System.out.format ("% s% d \ n", line.getstring ("first name"), line.gateInt ("age")); }
How can I replicate the above mentioned in Coldfusion?
Many thanks for taking your time to help.
-
Download the JDBC driver here. It works with the latest version of Cassandra (at the time of writing)
-
Cassandra JDBC Be sure to download dependencies too
-
Jar files
-
Restart ColdFusion / Rail
-
Type a data source "Other"
-
For driver class, enter " org.apache.cassandra.cql.jdbc.CassandraDriver "
< Li> -
This is it! You can now test Cassandra as a query of another database
The connection string should be " jdbc: cassandra: // host1 - host2 - host3: 9160 / keyspace1? PrimaryDisi = DC1 and backupdc = DC2 and stability = QUORUM "
I was able to work directly to the Java driver and the performance of the JDBC driver was better than directly calling the Java driver directly. There was a very simple table with the use of java directly while using jdbc driver 50 mms for connecting to c.
Thanks for Leigh and a Kruger mark for tip!
Comments
Post a Comment