I have generic functions in my project that handle each database type, whether it's MySql or Oracle and more by using Statement and JDBC Connection. However when I try using them for supporting Cassandra, it doesn't work so I created a new function just for Cassandra- that connects via Cluster. Is there an option to use the following without getting exceptions and not Cluster?
Connection conn = DriverManager.getConnection("jdbc:cassandra://TheIp:9042", userName, passWord);
Statement stmt = conn.createStatement();
The dependencies I have on my POM Maven are;
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>3.11.0</version>
</dependency>
It is possible to connect via JDBC using the Simba JDBC Driver for Apache Cassandra provided by DataStax for free. You can download the driver and the manual from DataStax Downloads.
However, if you're already developing your app in Java then have a look at the Cassandra Java driver. Here's a sample code which shows how to connect to and read from a Cassandra cluster:
Cheers!