cancel
Showing results for 
Search instead for 
Did you mean: 

jdbc error getting response for myTeststep; null

SOLVED
Highlighted
Occasional Contributor

jdbc error getting response for myTeststep; null

I've tried to connect to a Cassandra-DB with the following driver:

com.dbschema.CassandraJdbcDriver

https://github.com/DataGrip/cassandra-jdbc-driver

 

After configured the JDBC-Request Step and running them, I get two messages in the ReadyAPI Log and no StackTrace in the error log:

 

The JDBC driver [com.dbschema.CassandraJdbcDriver] is already registered.
Thu Mar 19 17:40:37 CET 2020: INFO: Error getting response for [myTestStep]; null

 

By passing a wrong Connection-String to the driver, a driver-exception occurs. So I think I use the correct Connection-String.

jdbc:cassandra://localhost:9042/mykeyspace?user=myusername&password=PASS_VALUE

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: jdbc error getting response for myTeststep; null

I have solved my problem. Because of trying difference jdbc-drivers, there was a wrong jar-file version.

 

Using my java-code in a groovy step, it has returned a Class-not-found-exception. Then I checked the jars and found a wrong version. The jdbc-driver expected a newer version of the cassandra-driver-core. On trying an earlier jdbc-driver, there was an older version in the lib directory.

 

Why is this exception not thrown in the normal JDBC-Request-Step?

 

 

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: jdbc error getting response for myTeststep; null

Have you tried with jdbc test ste if so what is the output?



Regards,
Rao.
Highlighted
Community Leader

Re: jdbc error getting response for myTeststep; null

@apu  : If your connection string is correct than might be a possibility that the Query you are sending to DataBase is not correct.

 

Try to check the query manually if still didn't solve the issue then please share any screenshot.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Occasional Contributor

Re: jdbc error getting response for myTeststep; null

I've wrote a small simple java program to test the connection string and the the sql-query. Both worked fine with my choosen jdbc-driver.

If something was wrong in my java programm, i get a helpful exception with stacktrace from the driver.

In Ready-API I get always the same error "null", don't matter what's wrong.

 

So heres is a sample screenshot of my Ready-API JDBC-Teststep, with the error:

Screenshot-JDBC.PNG

Highlighted
Community Leader

Re: jdbc error getting response for myTeststep; null

@apu  : I think it is returning null because it is unable to fetch data from DB as per your Query.

 

Could you please share your java code by which you are getting data.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Occasional Contributor

Re: jdbc error getting response for myTeststep; null

Oh, I missed to show my sql-query in Ready-API, but it is the same as in the java code.

 

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Test {

	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
		
	String url = "jdbc:cassandra://localhost:9042/mykeyspace?user=myusername&password=mypassword";
	       
        DriverManager.getDriver(url);
        Connection con = DriverManager.getConnection(url);
        
        Statement stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery("select * from mykeyspace.mytable limit 5;");
while (rs.next()) System.out.println(rs.getString(1)); rs.close(); stmt.close(); con.close(); } }
Highlighted
Occasional Contributor

Re: jdbc error getting response for myTeststep; null

I have solved my problem. Because of trying difference jdbc-drivers, there was a wrong jar-file version.

 

Using my java-code in a groovy step, it has returned a Class-not-found-exception. Then I checked the jars and found a wrong version. The jdbc-driver expected a newer version of the cassandra-driver-core. On trying an earlier jdbc-driver, there was an older version in the lib directory.

 

Why is this exception not thrown in the normal JDBC-Request-Step?

 

 

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!


Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors