jdbc error getting response for myTeststep; null
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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(); } }
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
