0

Unable to connect Cassandra using jdbc driver getting error java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid() returned false)

Apache beam JDBC IO not working with Casandra I tried with working cassandra-jdbc-1.2.5.jar

Here my pom

 <dependency>
        <groupId>org.apache-extras.cassandra-jdbc</groupId>
        <artifactId>cassandra-jdbc</artifactId>
        <version>1.2.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.cassandra/cassandra-thrift -->
    <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-thrift</artifactId>
        <version>1.2.5</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.cassandra/cassandra-clientutil -->
    <dependency>
        <groupId>org.apache.cassandra</groupId>
        <artifactId>cassandra-clientutil</artifactId>
        <version>1.2.5</version>
    </dependency>

    <dependency>
         <groupId>org.apache.thrift</groupId>
         <artifactId>libthrift</artifactId>
         <version>0.9.3</version>
    </dependency>

i did JDBC io using SQL and Oracle also but not working with Cassandra

input.getPipeline().apply(JdbcIO.<Row>read().withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create("org.apache.cassandra.cql.jdbc.CassandraDriver", "jdbc:cassandra://112.155.0.88:9160/beam")
.withUsername(username).withPassword(password))
.withQuery("Select personname from person"))
.withCoder(SchemaCoder.of(schema))
.withRowMapper((JdbcIO.RowMapper<Row>) resultSet -> {

}

and getting this error java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid() returned false) im wondering if it is supported by beam or not.

  • Could you paste the full stacktrace output? That would help debug it. – Rui Wang Feb 05 '19 at 00:09
  • @RuiWang here is my stacktrace – Rahul Jyala Feb 05 '19 at 12:12
  • ```DEBUG o.a.c.cql.jdbc.CassandraConnection - Connected to 192.168.0.77:9160 in Cluster 'beam' using Keyspace 'Test Cluster', CQL version '3.0.0' and Consistency level QUORUM 17:39:52.821 [direct-runner-worker] DEBUG o.a.b.r.direct.QuiescenceDriver - Executor Update: WorkUpdate{bundle=Optional.absent(), consumers=[], exception=Optional.of(org.apache.beam.repackaged.beam_runners_direct_java.com.google.common.util.concurrent.UncheckedExecutionException: org.apache.beam.sdk.util.UserCodeException: java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid() returned false))} `` – Rahul Jyala Feb 05 '19 at 12:12
  • Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid() returned false) at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039) at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) at org.apache.commons.dbcp2.DataSourceConnectionFactory.createConnection(DataSourceConnectionFactory.java:44) – Rahul Jyala Feb 05 '19 at 12:15
  • @RuiWang any help could be appricated – Rahul Jyala Feb 05 '19 at 12:18
  • Sorry that's less familiar to me. – Rui Wang Feb 05 '19 at 17:46
  • It's okay thanks for response – Rahul Jyala Feb 07 '19 at 09:13
  • @RahulJyala : Was your problem solved? because I have the similar issue – Yamini Sep 18 '19 at 01:37

0 Answers0