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 protected]'");
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 protected]'");(/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
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
Solved, thank you. I have another issue related with string enclosing:
Exception:
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM users where [email protected]]
Code:
```
How do I obtain SELECT * FROM users where ds_email_1='user.[email protected]'. I've already tried with '#(email)' without success. Thank you.
@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
Hi ampc.....can u please tell which oracle driver u have added to the project dependencies?
I think it was ojdbc14.
DeepikaSivakumar-Singtel notifications@github.com escreveu no dia quarta,
10/06/2020 Ã (s) 03:23:
Hi ampc.....can u please tell which oracle driver u have added to the
project dependencies?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/intuit/karate/issues/340#issuecomment-641680303, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AACFR22UB63XA4FV5EL35CTRV3VBFANCNFSM4ETTF7EA
.
--
Cumprimentos,
António Carvalho