# Logstash connection to Cassandra

**URL:** <https://discuss.elastic.co/t/logstash-connection-to-cassandra/120739>\
**Category:** Logstash\
**Created:** [February 20, 2018, 11:34pm UTC](https://discuss.elastic.co/t/logstash-connection-to-cassandra/120739 "2018-02-20T23:34:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcoughlin](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jcoughlin](https://discuss.elastic.co/u/jcoughlin)\
**Post date:** [February 20, 2018, 11:34pm UTC](https://discuss.elastic.co/t/logstash-connection-to-cassandra/120739/1 "2018-02-20T23:34:00Z")

</div>

I am trying to access a Cassandra database to connect to Elasticsearch/Kibana. I have the latest versions 6.2.1 of all and installed the logstash-input-jdbc

I am getting the following error:  
[2018-02-20T16:19:47,915][ERROR][logstash.inputs.jdbc] Unable to connect to database. Tried 1 times {:error\_message=\>"Java::JavaSql::SQLException: No suitable driver found for jdbc:cassandra://localhost:9042/weather"}

My configuration file is:

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:cassandra://localhost:9042/weather" # Your port (weather database)  
jdbc\_user =\> "" # The user value  
jdbc\_password =\> "" # The password  
jdbc\_driver\_library =\> "C:/Program Files/Elastic/Logstash/logstash-6.2.1/cassandrajdbc1.1.jar" # Jar path  
jdbc\_driver\_class =\> "com.dbschema.CassandraJdbcDriver" # Driver  
statement =\> "SELECT \* FROM weather" # Your query  
}  
}  
output {  
stdout { codec =\> json\_lines }  
}

I downloaded the driver from [www.dbschema.com](http://www.dbschema.com), and directly reference the jar. dbschema can access the Cassandra database.

What am I missing? Is there a better way to access Cassandra for use in Elasticsearch? That is my prime data store.

---

<div class="post-metadata">

**Author:** ![jcoughlin](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jcoughlin](https://discuss.elastic.co/u/jcoughlin)\
**Post date:** [February 21, 2018, 11:02pm UTC](https://discuss.elastic.co/t/logstash-connection-to-cassandra/120739/2 "2018-02-21T23:02:47Z")

</div>

I did find a solution that gets me farther. The dbschema has a number of jars that it needs to access the Cassandra database. If I include all these files, then I can access the database. One simple solution was to add all the jars (I put them into a directory 'cassandra' where the other jars were) into the CLASSPATH in the logstash.bat file:

for %%i in ("%LS\_HOME%\logstash-core\lib\jars\cassandra\*.jar") do (  
call :concat "%%i"  
)

I can now access Cassandra.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 21, 2018, 11:02pm UTC](https://discuss.elastic.co/t/logstash-connection-to-cassandra/120739/3 "2018-03-21T23:02:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
