SoapUI JDBC connection with Apache Cassandra

前端 未结 4 820
长发绾君心
长发绾君心 2021-01-16 03:43

Does anyone know how to connect to cassandra using JDBC connection string in SoapUI.

I have tried from my side, but not able to connect. Based on the research I came

4条回答
  •  天命终不由人
    2021-01-16 04:10

    I successfully connected to Cassandra 3.x with a SoapUI version 5.3.0 by cql connection.

    Here are my steps:

    1. copy these jars into bin/ext:

      dse-java-driver-core-1.4.0

      dse-java-driver-mapping-1.4.0

      metrics-core-3.0.2

      netty-all-4.1.6.Final

    2. update guava jar from lib:

      guava-18.0

    3. launch soapui and create groovy script:

        import com.datastax.driver.core.*;
    
        Cluster cluster = null;
    
        cluster = new Cluster.Builder().addContactPoints("127.0.0.1").withPort(9042).build();
        
        Session session = cluster.connect();                         
    
        PreparedStatement statement = session.prepare("select * from keyspace.exemple_table");
    
        ResultSet rs = session.execute(statement.bind());
    
        Row row = rs.one();

提交回复
热议问题