question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No suitable driver found

See original GitHub issue

Hello, I’m trying to setup a database connection using

    * def DbUtils = Java.type('util.DbUtils')
    * def config = { username: QC_DATABASE_Username, password: QC_DATABASE_Password, url: QC_DatabaseHostName_SID, driverClassName: 'oracle.jdbc.driver.OracleDriver'}
    * def db = new DbUtils(config);
    * def user = db.readRow("Select * from ssc_user where ds_email_1='email@example.com'");

I’ve already added the oracle driver to project dependencies. The DbUtils class is the same as the dogs.feature example.

ERROR:

at ✽.* def user = db.readRow("Select * from ssc_user where ds_email_1='email@example.com'");(/src/test/java/features/users/users.feature:67)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for QC_DatabaseHostName_SID

Karate:0.7.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Mar 6, 2018

@ampc maybe you are missing single quotes ?

* def sample_user = db.readRows("SELECT * FROM users where ds_email_1='" + email + "'")

suggestion, for non-karate questions like this, please use StackOveflow, thanks: https://stackoverflow.com/questions/tagged/karate

1reaction
ptrthomascommented, Mar 6, 2018

you have a mistake in your JSON I think:

* def config = { username: '#(QC_DATABASE_Username)', password: '#(QC_DATABASE_Password)', url: '#(QC_DatabaseHostName_SID)', driverClassName: 'oracle.jdbc.driver.OracleDriver' }

refer to the doc: https://github.com/intuit/karate#embedded-expressions

Read more comments on GitHub >

github_iconTop Results From Across the Web

No suitable driver found for 'jdbc:mysql://localhost:3306/mysql
Create a new folder in your project workspace and add the downloaded .jar file(eg:- mysql-connector-java-5.1.35-bin.jar ) · Right click your project > properties ......
Read more >
How to Fix java.sql.SQLException: No suitable driver found for ...
In order to solve this error, you need the MySQL JDBC driver like mysql-connector-java-5.1.36.jar in your classpath. If you use a driver which...
Read more >
No Suitable Driver Found For JDBC - Javatpoint
No suitable driver found for JDBC is an exception in Java that generally occurs when any driver is not found for making the...
Read more >
java.sql.SQLException: No suitable driver found for 'jdbc ...
This error comes when you are trying to connect to MySQL database from Java program using JDBC but either the JDBC driver for...
Read more >
Resolve java.sql.SQLException: No suitable driver found for ...
You will get this type of exception whenever your JDBC URL is not accepted by any of the loaded JDBC drivers by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found