When I use DBUtils.java in Eclipse and run the tests there it works fine, but when I run it through Jenkins the first time that DBUtils are used is failing. And the second works...
The first time that it uses db.readRows it fails.
Scenario: Account Create
Given path 'accounts'
And header Authorization = setup.authorization
And request {identifier: KarateCreation, subscribers:[{identifier:KarateCreation, firstName:KarateCreation, lastName:KarateCreation}]}
When method POST
And match response contains { id: '#number', identifier: KarateCreation }
Then status 201
* def id = response.id
* def accountNumber = response.identifier
# use jdbc to validate
* def config = { url: #(dbConnectionString), driverClassName: 'oracle.jdbc.OracleDriver' }
* def DbUtils = Java.type('restapi.util.DbUtils')
* def db = new DbUtils(config)
* def rs = db.readRows("SELECT ACCOUNTID, ACCOUNTNUMBER FROM ACCOUNT WHERE ACCOUNTNUMBER = 'KarateCreation'")
* match rs contains { ACCOUNTID: '#(id)', ACCOUNTNUMBER: KarateCreation }
Error:
* def rs = db.readRows("SELECT ACCOUNTID, ACCOUNTNUMBER FROM ACCOUNT WHERE ACCOUNTNUMBER = 'KarateCreation'")(Scenario: Account Create) Time elapsed: 0.039 sec <<< ERROR!
java.lang.RuntimeException: javascript evaluation failed: db.readRows("SELECT ACCOUNTID, ACCOUNTNUMBER FROM ACCOUNT WHERE ACCOUNTNUMBER = 'KarateCreation'")
at com.intuit.karate.ScriptBindings.eval(ScriptBindings.java:115)
at com.intuit.karate.ScriptBindings.updateBindingsAndEval(ScriptBindings.java:103)
at com.intuit.karate.ScriptBindings.evalInNashorn(ScriptBindings.java:88)
at com.intuit.karate.Script.evalJsExpression(Script.java:362)
at com.intuit.karate.Script.evalKarateExpression(Script.java:284)
at com.intuit.karate.Script.evalKarateExpression(Script.java:170)
at com.intuit.karate.Script.assign(Script.java:598)
at com.intuit.karate.Script.assign(Script.java:524)
at com.intuit.karate.StepDefs.def(StepDefs.java:305)
at ?.* def rs = db.readRows("SELECT ACCOUNTID, ACCOUNTNUMBER FROM ACCOUNT WHERE ACCOUNTNUMBER = 'KarateCreation'")(restapi/accounts/accounts.feature:31)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: Connection reset
question from:
https://stackoverflow.com/questions/65941623/whats-the-best-way-to-handle-database-records-with-date-type-fields 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…