knack
8 years agoNew Contributor
Issue with mysql driver in groovy script
A problem with mysql driver in Groovy Script:
1. Add Groovy Script as step to Test case
2. Add definition for mysql driver, for example (the driver has been put before into bin\ext and the tool is restarted after that):
import groovy.sql.Sql def testProject = context.testCase.testSuite.project def user = testProject.getPropertyValue('user') def password = testProject.getPropertyValue('password') def props = [user: user, password: password, allowMultiQueries: 'true'] def url = testProject.getPropertyValue('url') def driver = 'com.mysql.jdbc.Driver' def sql = Sql.newInstance(url, user, password, driver)
3. Run the script - works fine.
4. Restart the tool
5. Run the script again - java.sql.SQLException: No suitable driver found for
But if run JDBC request with the driver from same test case and run the groovy script again - working again.
- Well.
It might require to register the driver first using below statement before invoking sql instance.
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.mysql.jdbc.Driver" )
Refer the same from below thread, #10
https://www.soapui.org/scripting-properties/tips-tricks.html